I use setxkbmap and xkb-switch combination with config.py:
@lazy.function
def z_next_keyboard(qtile):
check_output(['xkb-switch', '-n'], shell=True)
filenames = {
'us': '~/.config/qtile/flags/en.png',
'lt(sgs)': '~/.config/qtile/flags/sgs.png',
'ru(phonetic)': '~/.config/qtile/flags/ru.png',
}
keyboard = check_output(
['xkb-switch', '-p'],
shell=True).decode('utf-8').replace('\n', '')
qtile.widgets_map.get('image').cmd_update(filenames[keyboard])
@lazy.function
def z_next_keyboard_group(_):
global current_layout
# options = 'grp:alt_space_toggle,compose:rctrl,lv3:ralt_switch,caps:hyper'
options = 'grp:alt_space_toggle,compose:rctrl,lv3:ralt_switch'
layouts = {
'en-sgs-ru': [
'us,lt,ru',
',sgs,phonetic'
],
'en-sgs': [
'us,lt',
',sgs'
],
}
current_layout = 'en-sgs' if current_layout == 'en-sgs-ru' else 'en-sgs-ru'
layout = layouts[current_layout]
command = f'setxkbmap -layout {layout[0]} -variant {layout[1]} -option {options}'
run(command.split(), check=True)
<...>
EzKey("A-<space>", z_next_keyboard, desc='switch keyboard layout'),
EzKey("S-A-<space>", z_next_keyboard_group, desc='switch keyboard group'),
And files to display flag in the bar
Mostly I use Samogitian or English, but if I want to write something in Russian I switch to bigger group
I use setxkbmap and xkb-switch combination with config.py:
@lazy.function def z_next_keyboard(qtile): check_output(['xkb-switch', '-n'], shell=True) filenames = { 'us': '~/.config/qtile/flags/en.png', 'lt(sgs)': '~/.config/qtile/flags/sgs.png', 'ru(phonetic)': '~/.config/qtile/flags/ru.png', } keyboard = check_output( ['xkb-switch', '-p'], shell=True).decode('utf-8').replace('\n', '') qtile.widgets_map.get('image').cmd_update(filenames[keyboard])
@lazy.function def z_next_keyboard_group(_): global current_layout
# options =
'grp:alt_space_toggle,compose:rctrl,lv3:ralt_switch,caps:hyper' options = 'grp:alt_space_toggle,compose:rctrl,lv3:ralt_switch' layouts = { 'en-sgs-ru': [ 'us,lt,ru', ',sgs,phonetic' ], 'en-sgs': [ 'us,lt', ',sgs' ], } current_layout = 'en-sgs' if current_layout == 'en-sgs-ru' else 'en-sgs-ru' layout = layouts[current_layout] command = f'setxkbmap -layout {layout[0]} -variant {layout[1]} -option {options}' run(command.split(), check=True) <...> EzKey("A-", z_next_keyboard, desc='switch keyboard layout'), EzKey("S-A-", z_next_keyboard_group, desc='switch keyboard group'),
And files to display flag in the bar [image: image.png]
On Wed, 11 Jan 2023 at 02:05, Stepan Zhukovskiy @.***> wrote:
Is 2nd a problem with Qtile or a more general one? Does anyone knows how to deal with it?
but even switching layout with setxkbmap and disabling the keyboard layout widget does not help with Ctrl-c, Ctrl-v, Ctrl-a in my case.
The problem must be within Qtile. I'm the author of that reddit post you mentioned, and the actions I described there fixed the issue for me. Looks like the problem is not only because of the setxkbmap and keyboard layout widget, but then I have no idea, what causes it. Also, I've tried XMonad, and the problem wasn't present there in any way, so no way this problem is general.
Here are my dotfiles https://github.com/LeKSuS-04/my-arch/tree/master/dotfiles/qtile This configuration doesn't have such an issue (Ctrl-a, Ctrl-c and others still work in russian layout), so you might be interested in taking a look at it.
Looking at the sources, it seems that qtile switches the keyboard language by changing the setxkbmap keys, which causes the keybindings to stop working. The solution from LeKSuS-04 works. He created a custom keyboard widget and switches the language with the xkb-switch utility, which needs to be installed additionally, as in my case on VoidLinux. You will also need pip install dbus-next.
Additionally I created: https://wiki.archlinux.org/title/Xorg/Keyboard_configuration
/etc/X11/xorg.conf.d/00-keyboard.conf
Section "InputClass" Identifier "system-keyboard" Option "XkbLayout" "ru, us" Option "XkbModel" "pc105" EndSection
Without this, xkb-switch -n will simply not see the second layout.
— Reply to this email directly, view it on GitHub https://github.com/qtile/qtile/issues/933#issuecomment-1378058077, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA77KPBWHZK6YTN33MVKVSDWRX2ODANCNFSM4CILSULA . You are receiving this because you commented.Message ID: @.***>