From 7c17516874eae1787b2e4e5afd0c4c63938d2a81 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sun, 1 Oct 2017 05:45:52 +0200 Subject: [PATCH] [modules/layout-xkb] Gracefully handle missing xkbgroup library Show "n/a" is xkbgroup is not installed/available see #177 --- bumblebee/modules/layout-xkb.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bumblebee/modules/layout-xkb.py b/bumblebee/modules/layout-xkb.py index d78d7f8..dfdc6df 100644 --- a/bumblebee/modules/layout-xkb.py +++ b/bumblebee/modules/layout-xkb.py @@ -13,7 +13,11 @@ import bumblebee.input import bumblebee.output import bumblebee.engine -from xkbgroup import * +has_xkb = True +try: + from xkbgroup import * +except ImportError: + has_xkb = False import logging log = logging.getLogger(__name__) @@ -35,6 +39,8 @@ class Module(bumblebee.engine.Module): self._set_keymap(-1) def _set_keymap(self, rotation): + if not has_xkb: return + xkb = XKeyboard() if xkb.groups_count < 2: return # nothing to doA