Something customization for Regolith (Wayland)

Regolith is an Ubuntu desktop environment that build on top of i3 window manager.

Why Wayland and not X11?

I’ve experienced some lagging and delaying issues with X11, especially when using browsers such as video couldn’t play or if it’s played, it delayed and glitched all the time. So when switching to Wayland, the experience feels much better and the same as native Ubuntu. However, Regolith Wayland needs some manual configurations that I want to use in my workflow.

Ibus languages

Although in Regolith Wayland, Ibus deamon was running, it couldn’t pick up the configured languages that were setup in Gnome setting, as well as the shortcut key. So the workaround I made was to create a shell script that manually run ibus command to set the language, then add an i3 config to bind the shortcut key that I wanted.

Shell script

In my case, I only needed 2 languages, English and Vietnamese (Unikey), so my shell script looked like this:

#!/bin/bash
current=$(ibus engine)
if [ "$current" = "Unikey" ]; then
  ibus engine xkb:us::eng
else
  ibus engine Unikey
fi

But if more languages needed, the script could be tweaked like:

#!/bin/bash

# Define your input engines here, e.g English, Vietnamese (Unikey), Finnish
ENGINES=( "xkb:us::eng" "Unikey", xkb:fi::fin)

# Get the current engine
CURRENT=$(ibus engine)

# Find the index of the current engine
NEXT=0
for i in "${!ENGINES[@]}"; do
    if [[ "${ENGINES[$i]}" == "$CURRENT" ]]; then
        NEXT=$(( (i + 1) % ${#ENGINES[@]} ))
        break
    fi
done

# Switch to the next engine
ibus engine "${ENGINES[$NEXT]}"

Add i3 config

Regolith Wayland would look for user’s config in ~/.config/regolith3/sway/config.d/, so I added ibus.conf file there, with the content

bindsym Alt+Space exec "~/.config/sway_language_switch.sh"

i3status-rust

Regolith Wayland used i3status-rust instead of the normal i3status for styling the i3bar. The i3status-rust version that were used as of the moment writing this was 0.22.0 eventhough there was newer version released. I had to dig into i3status-rust github repository to look for documentation about its supported modules, and turned out it did supported ibus (but not anymore in the future versions).

Regolith would look for user’s own config in ~/.config/regolith3/i3status-rust/config.toml, so first I had to copy the default config, which was in /etc/regolith3/i3status-rust/config.toml, over to the user’s config mentioned above. Then added ibus block in there

[[block]]
block = "ibus"

[block.mappings]
"Unikey" = "Vi"
"xkb:us::eng" = "EN"

After this, whenever I wanted to switch the input language between English and Vietnamese, I simply pressed Alt + Space and also the changes would be reflected in i3 status bar as well.