Adds a check for hostname == 'warthog' which currently is my only system with a HiDPI screen in order to adjust the font size and the panel height.
53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
from barpyrus import hlwm
|
|
from barpyrus import widgets as W
|
|
from barpyrus.core import Theme
|
|
from barpyrus import lemonbar
|
|
from barpyrus import conky
|
|
import sys
|
|
import os
|
|
|
|
# set up connection to herbstluftwm in order to get events and to call
|
|
# herbstclient commands
|
|
hc = hlwm.connect()
|
|
|
|
# get monitor geometry
|
|
monitor = sys.argv[1] if len(sys.argv) >= 2 else 0
|
|
(x, y, monitor_w, monitor_h) = hc.monitor_rect(monitor)
|
|
|
|
# height/width of the panel
|
|
height = 16 if os.uname().nodename != 'warthog' else 30
|
|
width = monitor_w
|
|
|
|
# set fonts used by lemonbar
|
|
if os.uname().nodename == 'warthog':
|
|
text_font = '*-*-lucidatypewriter-medium-*-*-*-26-*-*-*-*-*-*-*'
|
|
symbol_font = '*-wuncon-siji-medium-r-normal-*-26-200-100-*-c-*-iso10646-1'
|
|
else:
|
|
text_font = '*-*-lucidatypewriter-medium-*-*-*-12-*-*-*-*-*-*-*'
|
|
symbol_font = '*-wuncon-siji-medium-r-normal-*-12-100-100-*-c-80-iso10646-1'
|
|
|
|
# get space for the panel
|
|
hc(['pad', str(monitor), str(height)])
|
|
|
|
# theme for grey frame:
|
|
grey_frame = Theme(bg = '#303030', fg = '#EFEFEF', padding = (3,3))
|
|
|
|
# initialize lemonbar
|
|
bar = lemonbar.Lemonbar(geometry = (x, y, width, height),
|
|
font = text_font, symbol_font = symbol_font)
|
|
|
|
# widget configuration
|
|
bar.widget = W.ListLayout([
|
|
W.RawLabel('%{l}'),
|
|
hlwm.HLWMTags(hc, monitor, tag_renderer = hlwm.underlined_tags),
|
|
|
|
W.RawLabel('%{c}'),
|
|
hlwm.HLWMMonitorFocusLayout(hc, monitor,
|
|
# this widget is shown on the focused monitor:
|
|
grey_frame(hlwm.HLWMWindowTitle(hc)),
|
|
# this widget is shown on all unfocused monitors:
|
|
W.RawLabel('')),
|
|
|
|
W.RawLabel('%{r}'),
|
|
grey_frame(W.DateTime('%d. %B, %H:%M')),
|
|
])
|