Gxkb - X11 keyboard indicator and switcher

(gxkb is preinstalled in Mabox since Istredd release)

gxkb is a tiny indicator applet which allows to quickly switch between different keyboard layouts in X. A flag corresponding to the country of the active layout is shown in the indicator area.

Github repo: GitHub - zen-tools/gxkb: πŸ‡ΊπŸ‡¦ πŸ‡΅πŸ‡± πŸ‡±πŸ‡Ή X11 keyboard indicator and switcher

Mabox_20220914-13-42-44

Installation

yay gxkb

Configuration

Example config file ~/.config/gxkb/gxkb.cfg

[xkb config]
group_policy=2
default_group=0
never_modify_config=false
model=pc105
layouts=pl,ua,lt,us
variants=,,
toggle_option=grp:alt_shift_toggle
compose_key_position=

Most interesting options:

layouts=pl,ua,lt,us
toggle_option=grp:alt_shift_toggle

Available layouts (in this example): Polish, Ukrainian, Latvian, English (USA)
Toggle between layouts: alt + shift
Mouse wheel above system tray indicator also works.
Instead of grp:alt_shift_toggle you can use whatever the following command gives you:

grep grp:.*toggle /usr/share/X11/xkb/rules/base.lst

Configure those options to your needs.
You can use up to 4 layouts.

Autostart

Copy desktop file to needed location:

 cp /usr/share/applications/gxkb.desktop ~/.config/autostart/

Now you can enable/disable autostarting from GUI.
Menu β†’ Mabox Config β†’ Autostart β†’ Choose apps/services (GUI)

Custom flags

By default many flags are missing, but you can put custom flags to ~/.local/share/gxkb/flags.
Good flags β†’ GitHub - gosquared/flags: GoSquared's flag icon set (MIT licensed)
24px flags-iso works well.
gxkb expects flags named with lowercase letters, like: pl.png, ua.png, lt.png.
If you use flags from above repo, go to directory and rename them:

cd ~/.local/share/gxkb/flags
for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done

Enjoy :slight_smile:

4 Likes

Is it going to have a shortcut to edit the config file just like other text config files Mabox has?

You can find config file with super + F1 and searching for gxkb. Same for any other config file from ~/.config/ directory.
You can also add menu position for that somewhere if you like.
For example to Settings Menu super + s

echo "Keyboard layout config,xdg-open ~/.config/gxkb/gxkb.cfg" >> ~/.config/mabox/settings.csv

I’m not sure if I should add it to this menu by default - as gxkb is not enabled by default in Mabox.
Maybe mention this in Mabox Linux Manual will be enough.

1 Like