From 63ef04543124e2d341df235d65c741a79a65d4b1 Mon Sep 17 00:00:00 2001 From: Ivan Chinenov Date: Wed, 11 Dec 2019 15:14:02 +0300 Subject: [PATCH] Add an option to disable variant name in layout-xkb --- bumblebee/modules/layout-xkb.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bumblebee/modules/layout-xkb.py b/bumblebee/modules/layout-xkb.py index 3e89c9a..04f4114 100644 --- a/bumblebee/modules/layout-xkb.py +++ b/bumblebee/modules/layout-xkb.py @@ -9,6 +9,7 @@ and python module: Parameters: * layout-xkb.showname: Boolean that indicate whether the full name should be displayed. Defaults to false (only the symbol will be displayed) + * layout-xkb.show_variant: Boolean that indecates whether the variant name should be displayed. Defaults to true. """ import bumblebee.input @@ -33,6 +34,7 @@ class Module(bumblebee.engine.Module): cmd=self._next_keymap) engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd=self._prev_keymap) + self._show_variant = bumblebee.util.asbool(self.parameter("show_variant", "true")) def _next_keymap(self, event): self._set_keymap(1) @@ -54,7 +56,9 @@ class Module(bumblebee.engine.Module): xkb = XKeyboard() log.debug("group num: {}".format(xkb.group_num)) name = xkb.group_name if bumblebee.util.asbool(self.parameter("showname")) else xkb.group_symbol - return "{} ({})".format(name, xkb.group_variant) if xkb.group_variant else name + if self._show_variant: + return "{} ({})".format(name, xkb.group_variant) if xkb.group_variant else name + return name except Exception: return "n/a"