From ad4246d52da819e17a05556b10c73937b09c6a2b Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sat, 30 Sep 2017 16:21:51 +0200 Subject: [PATCH] [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 --- bumblebee/modules/layout-xkb.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bumblebee/modules/layout-xkb.py b/bumblebee/modules/layout-xkb.py index a31a51e..86186a9 100644 --- a/bumblebee/modules/layout-xkb.py +++ b/bumblebee/modules/layout-xkb.py @@ -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: