From 279411176e63bf5142be0b105984ea76196c1590 Mon Sep 17 00:00:00 2001 From: Martin Wallgren Date: Tue, 4 Dec 2018 13:13:36 +0100 Subject: [PATCH] [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. --- bumblebee/modules/layout-xkb.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/bumblebee/modules/layout-xkb.py b/bumblebee/modules/layout-xkb.py index dfdc6df..fac53b8 100644 --- a/bumblebee/modules/layout-xkb.py +++ b/bumblebee/modules/layout-xkb.py @@ -43,14 +43,9 @@ class Module(bumblebee.engine.Module): 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 + layouts = xkb.groups_symbols + idx = layouts.index(xkb.group_symbol) + xkb.group_symbol = str(layouts[(idx + rotation) % len(layouts)]) def current_layout(self, widget): try: