bumblebee-status: Layout module doesn't handle multiple layouts properly

I’m currently using bumblebee with the following Xorg configuration:

Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us,ara"
        Option "XkbVariant" ",qwerty_digits"
        Option "XkbOptions" "caps:swapescape"
EndSection

The layout module shows as follows:

Imgur

It should detect and display the active layout(s) and allow switching between them as is the case in gnome-panel, for example.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 30 (16 by maintainers)

Commits related to this issue

Most upvoted comments

@mahmoudhossam @tobi-wan-kenobi xkbgroup 0.2.0 released, please check it out!

I just spent some time playing around with this issue.

What happened in my setup is that by using this line exec --no-startup-id setxkbmap -layout "fr,us,ru" -option "grp:alt_shift_toggle" in my .config/i3/config, when I switch the layout, the keymap changes but the setxkbmap -query still gives out the layout fr,us,ru.

I solved this locally by creating a script that changes the layout (fr,us,ru then us,ru,fr, etc…) instead of using the option grp:alt_shift_toggle above. And I use:

exec --no-startup-id setxkbmap -layout "fr,us,ru"
bindsym $mod2+space exec "~/Documents/i3/change_layout.sh"

where change layout is:

#!/bin/bash
arr_layouts=$(setxkbmap -query | grep "^layout:" | sed "s/layout:\s *\([a-z,]*\)/\1/g")
IFS="," read -a arr_layouts <<< $arr_layouts
n_layouts=${#arr_layouts[@]}
new_layout=$(for ((i=1; i<=$n_layouts-1; i++)); do printf ${arr_layouts[$i]}","; done)${arr_layouts[0]}
setxkbmap $new_layout

I’m sorry I don’t have a more thorough insight on this. Is there a better solution ?

@mahmoudhossam I fully agree, the current implementation seems a safe choice now.

Glad to hear it (finally) works!

Yeah, that would be the short-term solution. Mid-term, I hope that there will be a xkbgroup release on PIP that 1. supports Python 2.7 and 2. works with missing cfree().

Thanks & have a nice day!

Update: I’m not neglecting this issue, I can now call the libX11 library from Python and just need to find the time to figure out how to query the layouts.