[modules/layout-xkb] Use set-xkbmap to switch layouts
Use the data retrieved via xkb and set the new layouts and variants using set-xkbmap. see #177
This commit is contained in:
parent
a98c337cc6
commit
ad4246d52d
1 changed files with 10 additions and 1 deletions
|
@ -32,7 +32,16 @@ class Module(bumblebee.engine.Module):
|
|||
self._set_keymap(-1)
|
||||
|
||||
def _set_keymap(self, rotation):
|
||||
pass
|
||||
xkb = XKeyboard()
|
||||
if xkb.groups_count < 2: return # nothing to doA
|
||||
|
||||
layouts = xkb.groups_symbols[rotation:] + xkb.groups_symbols[:rotation]
|
||||
variants = xkb.groups_variants[rotation:] + xkb.groups_variants[:rotation]
|
||||
|
||||
try:
|
||||
bumblebee.util.execute("setxkbmap -layout {} -variant {}".format(",".join(layouts), ",".join(variants)))
|
||||
except RuntimeError:
|
||||
pass
|
||||
|
||||
def current_layout(self, widget):
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue