[modules/layout-xkb] use XKeyboard to set layout
XKeyboard has support for setting the layout directly. There is no need to explicitly execute an external command.
This commit is contained in:
parent
1850ceefdc
commit
279411176e
1 changed files with 3 additions and 8 deletions
|
@ -43,14 +43,9 @@ class Module(bumblebee.engine.Module):
|
||||||
|
|
||||||
xkb = XKeyboard()
|
xkb = XKeyboard()
|
||||||
if xkb.groups_count < 2: return # nothing to doA
|
if xkb.groups_count < 2: return # nothing to doA
|
||||||
|
layouts = xkb.groups_symbols
|
||||||
layouts = xkb.groups_symbols[rotation:] + xkb.groups_symbols[:rotation]
|
idx = layouts.index(xkb.group_symbol)
|
||||||
variants = xkb.groups_variants[rotation:] + xkb.groups_variants[:rotation]
|
xkb.group_symbol = str(layouts[(idx + rotation) % len(layouts)])
|
||||||
|
|
||||||
try:
|
|
||||||
bumblebee.util.execute("setxkbmap -layout {} -variant {}".format(",".join(layouts), ",".join(variants)))
|
|
||||||
except RuntimeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def current_layout(self, widget):
|
def current_layout(self, widget):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue