[modules/layout-xkb] Parameter to show full layout name

If parameter "showname" is specified, do not show the symbol (e.g.
"us"), but the full layout name (e.g. "English (US)").

see #177
This commit is contained in:
Tobias Witek 2017-09-30 16:26:20 +02:00
parent ad4246d52d
commit 855012f05d

View file

@ -4,6 +4,9 @@
Requires the following library: Requires the following library:
* libX11.so.6 * libX11.so.6
Parameters:
* layout-xkb.showname: Boolean that indicate whether the full name should be displayed. Defaults to false (only the symbol will be displayed)
""" """
import bumblebee.input import bumblebee.input
@ -47,7 +50,8 @@ class Module(bumblebee.engine.Module):
try: try:
xkb = XKeyboard() xkb = XKeyboard()
log.debug("group num: {}".format(xkb.group_num)) log.debug("group num: {}".format(xkb.group_num))
return "{} ({})".format(xkb.group_symbol, xkb.group_variant) if xkb.group_variant else xkb.group_symbol 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
except Exception: except Exception:
return "n/a" return "n/a"