I'm trying to configure keyboard layout switching by keyboard shortcut in Openbox DE.

$ cat /etc/default/keyboard 

$ cat /etc/bash.bashrc | grep kblayout
source /home/user/.kblayout.sh

$ cat /home/user/.kblayout.sh 
setxkbmap -layout us,ru,ua -option grp:lwin_space_toggle

$ setxkbmap -print -verbose 10
Setting verbose level to 10
locale is C
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Applied rules from /usr/share/X11/xkb/rules/evdev:
rules:      /usr/share/X11/xkb/rules/evdev
model:      pc105
layout:     us
options:    grp:alt_shift_toggle,grp:lalt_lshift_toggle,grp:alt_shift_toggle,grp:win_space_toggle,grp_led:scroll,grp:alt_shift_toggle,grp_led:scroll
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete+ledscroll(group_lock)
symbols:    pc+us+inet(evdev)+group(win_space_toggle)+group(lalt_lshift_toggle)+group(alt_shift_toggle)
geometry:   pc(pc105)
xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete"  };
    xkb_compat    { include "complete+ledscroll(group_lock)"    };
    xkb_symbols   { include "pc+us+inet(evdev)+group(win_space_toggle)+group(lalt_lshift_toggle)+group(alt_shift_toggle)"   };
    xkb_geometry  { include "pc(pc105)" };

$ cat .config/gxkb/gxkb.cfg 
[xkb config]

$ cat /etc/X11/xorg.conf
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us,ru,ua"
        Option "XkbModel" "pc105"
        Option "XkbVariant" "pc105"
        Option "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll"

For terminal window input keyboard layout could be changed with those options by Win+Space and Alt+Shift after I run new instance of bash. For new instance of bash it works, but not for bash in just opened terminal. setxkbmap -layout ru or whatever also works in terminal. In current terminal session without running new instance of bash I run setxkbmap command or source a script with that command. But nothing of it works in Openbox GUI applications.

I've installed tint2 panel to be able to switch keyboard layouts by mouse clicking.

Keyboard shortcuts in IBus Preferences -> Keyboard Shortcuts do not actually change keyboard layout. Tried different keys combinations:

enter image description here

The same preferences somehow work in iceWM, but it works strangely there (when I type in different non-english layout, it often inputs English letters instead of Cyrillic letters. It require removing that letters a few times till letters become Cyrillic). I do not often use Cyrillic and I could log in into Unity for normal keyboard layout switching, but I want to figure out, how to configure it correctly in Openbox.


1 Answer 1


Openbox looks for user defined configs at ~/.config/openbox. If nothing was there, then it looks for default config files at : /etc/xdg/openbox/.

Create a new user then make a copy of default config files in your user directory so we can edit them:

mkdir ~/.config && cp -r /etc/xdg/openbox ~/.config

Then add this line:

setxkbmap -layout "us,ru" -option "grp:alt_shift_toggle" &



Now you can change the layout using Alt+Shift after a logout and re-login.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.