[modules/layout-xkb] Gracefully handle missing xkbgroup library
Show "n/a" is xkbgroup is not installed/available see #177
This commit is contained in:
parent
e0e59b863c
commit
7c17516874
1 changed files with 7 additions and 1 deletions
|
@ -13,7 +13,11 @@ import bumblebee.input
|
|||
import bumblebee.output
|
||||
import bumblebee.engine
|
||||
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue