config: barpyrus: config.py: add keyboard layout switcher

There are now several keyboard layouts to switch to with the click of a
button. In order to not make the panel too crowded the available layouts
are hidden behind a ShortLongLayout which allows to make them visible
only when necessary.
This commit is contained in:
Thomas Preisner 2018-03-02 01:29:24 +01:00
parent 7f624d2742
commit e31c496951

View file

@ -49,6 +49,14 @@ def frame(content, bg, fg, padding = (3, 3)):
# conky specific configuration # conky specific configuration
conky_text = '' conky_text = ''
# options for hlwm.HLWMLayoutSwitcher widget
xkblayouts = [
'us us -variant altgr-intl us'.split(' '),
'de de de'.split(' '),
]
setxkbmap = 'setxkbmap -option compose:menu -option ctrl:nocaps'
setxkbmap += ' -option compose:ralt -option compose:rctrl'
# get space for the panel # get space for the panel
hc(['pad', str(monitor), str(height)]) hc(['pad', str(monitor), str(height)])
@ -70,5 +78,12 @@ bar.widget = W.ListLayout([
W.RawLabel('%{r}'), W.RawLabel('%{r}'),
conky.ConkyWidget(text = conky_text), conky.ConkyWidget(text = conky_text),
W.ShortLongLayout(
W.RawLabel(''),
W.ListLayout([
hlwm.HLWMLayoutSwitcher(hc, xkblayouts, command = setxkbmap.split(' ')),
W.RawLabel(' '),
])
),
frame(W.DateTime('%d. %B, %H:%M'), 'grey', 'white'), frame(W.DateTime('%d. %B, %H:%M'), 'grey', 'white'),
]) ])