I'm trying to configure keyboard layout switching by keyboard shortcut in Openbox DE.
$ cat /etc/default/keyboard
XKBLAYOUT="us,ua,ru"
XKBVARIANT=",winkeys,"
BACKSPACE="guess"
XKBMODEL="pc105"
XKBOPTIONS="grp:alt_shift_toggle,grp:win_space_toggle,grp_led:scroll"
$ cat /etc/bash.bashrc | grep kblayout
source /home/user/.kblayout.sh
$ cat /home/user/.kblayout.sh
#!/bin/bash
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...
Success.
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]
group_policy=2
default_group=0
never_modify_config=false
model=pc105
layouts=us,ru,ua
variants=
toggle_option=grp:lwin_toggle,lv3:switch,terminate:ctrl_alt_bksp,grp_led:scroll
compose_key_position=
$ 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"
EndSection
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:
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.
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:
Then add this line:
To
Now you can change the layout using Alt+Shift after a logout and re-login.