config: barpyrus: config.py: reinit with basic configuration
The current config.py is rather messy. In order to get a nice and clean configuration for barpyrus I decided to completely rewrite it from scratch. For now it will only show the tags, the focused window title and the date/time. Further functionality will be added later.
This commit is contained in:
parent
4ae0621e21
commit
82db8c5d7a
1 changed files with 24 additions and 73 deletions
|
|
@ -5,94 +5,45 @@ from barpyrus import lemonbar
|
||||||
from barpyrus import conky
|
from barpyrus import conky
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
# Copy this config to ~/.config/barpyrus/config.py
|
|
||||||
|
|
||||||
# set up a connection to herbstluftwm in order to get events
|
# set up connection to herbstluftwm in order to get events and to call
|
||||||
# and in order to call herbstclient commands
|
# herbstclient commands
|
||||||
hc = hlwm.connect()
|
hc = hlwm.connect()
|
||||||
|
|
||||||
# get the geometry of the monitor
|
# get monitor geometry
|
||||||
monitor = sys.argv[1] if len(sys.argv) >= 2 else 0
|
monitor = sys.argv[1] if len(sys.argv) >= 2 else 0
|
||||||
(x, y, monitor_w, monitor_h) = hc.monitor_rect(monitor)
|
(x, y, monitor_w, monitor_h) = hc.monitor_rect(monitor)
|
||||||
if os.uname().nodename == "warthog":
|
|
||||||
height = 30 # height of the panel
|
|
||||||
else:
|
|
||||||
height = 16 # height of the panel
|
|
||||||
|
|
||||||
width = monitor_w # width of the panel
|
# height/width of the panel
|
||||||
hc(['pad', str(monitor), str(height)]) # get space for the panel
|
height = 16
|
||||||
|
width = monitor_w
|
||||||
|
|
||||||
# An example conky-section:
|
# set fonts used by lemonbar
|
||||||
# icons
|
text_font = '*-*-lucidatypewriter-medium-*-*-*-12-*-*-*-*-*-*-*'
|
||||||
bat_icons = [
|
symbol_font = '*-wuncon-siji-medium-r-normal-*-12-100-100-*-c-80-iso10646-1'
|
||||||
0xe242, 0xe243, 0xe244, 0xe245, 0xe246,
|
|
||||||
0xe247, 0xe248, 0xe249, 0xe24a, 0xe24b,
|
|
||||||
]
|
|
||||||
# first icon: 0 percent
|
|
||||||
# last icon: 100 percent
|
|
||||||
bat_delta = 100 / len(bat_icons)
|
|
||||||
conky_text = '%{F\\#9fbc00}%{T2}\ue026%{T-}%{F\\#989898}${cpu}% '
|
|
||||||
conky_text += '%{F\\#9fbc00}%{T2}\ue021%{T-}%{F\\#989898}${memperc}% '
|
|
||||||
conky_text += '%{F\\#9fbc00}%{T2}\ue13c%{T-}%{F\\#989898}${downspeedf}K '
|
|
||||||
conky_text += '%{F\\#9fbc00}%{T2}\ue13b%{T-}%{F\\#989898}${upspeedf}K '
|
|
||||||
conky_text += "${if_existing /sys/class/power_supply/BAT0}"
|
|
||||||
conky_text += "%{T2}"
|
|
||||||
conky_text += "${if_match \"$battery\" == \"discharging $battery_percent%\"}"
|
|
||||||
conky_text += "%{F\\#FFC726}"
|
|
||||||
conky_text += "$else"
|
|
||||||
conky_text += "%{F\\#9fbc00}"
|
|
||||||
conky_text += "$endif"
|
|
||||||
for i,icon in enumerate(bat_icons[:-1]):
|
|
||||||
conky_text += "${if_match $battery_percent < %d}" % ((i+1)*bat_delta)
|
|
||||||
conky_text += chr(icon)
|
|
||||||
conky_text += "${else}"
|
|
||||||
conky_text += chr(bat_icons[-1]) # icon for 100 percent
|
|
||||||
for _ in bat_icons[:-1]:
|
|
||||||
conky_text += "${endif}"
|
|
||||||
conky_text += "%{T-} $battery_percent% "
|
|
||||||
conky_text += "${endif}"
|
|
||||||
conky_text += "%{F-}"
|
|
||||||
|
|
||||||
# example options for the hlwm.HLWMLayoutSwitcher widget
|
# get space for the panel
|
||||||
xkblayouts = [
|
hc(['pad', str(monitor), str(height)])
|
||||||
'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'
|
|
||||||
|
|
||||||
# you can define custom themes
|
# theme for grey frame:
|
||||||
grey_frame = Theme(bg = '#303030', fg = '#EFEFEF', padding = (3,3))
|
grey_frame = Theme(bg = '#303030', fg = '#EFEFEF', padding = (3,3))
|
||||||
|
|
||||||
# Widget configuration:
|
# initialize lemonbar
|
||||||
if os.uname().nodename == "warthog":
|
bar = lemonbar.Lemonbar(geometry = (x, y, width, height),
|
||||||
bar = lemonbar.Lemonbar(geometry = (x,y,width,height),
|
font = text_font, symbol_font = symbol_font)
|
||||||
font = "*-*-lucidatypewriter-medium-*-*-*-26-*-*-*-*-*-*-*",
|
|
||||||
symbol_font = "-wuncon-siji-medium-r-normal--26-200-100-*-c-*-iso10646-1")
|
# widget configuration
|
||||||
else:
|
|
||||||
bar = lemonbar.Lemonbar(geometry = (x,y,width,height),
|
|
||||||
font = "*-*-lucidatypewriter-medium-*-*-*-12-*-*-*-*-*-*-*",
|
|
||||||
symbol_font = "-wuncon-siji-medium-r-normal--10-100-75-75-c-80-iso10646-1")
|
|
||||||
bar.widget = W.ListLayout([
|
bar.widget = W.ListLayout([
|
||||||
W.RawLabel('%{l}'),
|
W.RawLabel('%{l}'),
|
||||||
hlwm.HLWMTags(hc, monitor, tag_renderer = hlwm.underlined_tags),
|
hlwm.HLWMTags(hc, monitor, tag_renderer = hlwm.underlined_tags),
|
||||||
|
|
||||||
W.RawLabel('%{c}'),
|
W.RawLabel('%{c}'),
|
||||||
hlwm.HLWMMonitorFocusLayout(hc, monitor,
|
hlwm.HLWMMonitorFocusLayout(hc, monitor,
|
||||||
# this widget is shown on the focused monitor:
|
# this widget is shown on the focused monitor:
|
||||||
grey_frame(hlwm.HLWMWindowTitle(hc)),
|
grey_frame(hlwm.HLWMWindowTitle(hc)),
|
||||||
# this widget is shown on all unfocused monitors:
|
# this widget is shown on all unfocused monitors:
|
||||||
conky.ConkyWidget('df /: ${fs_used_perc /}%')
|
W.RawLabel('')),
|
||||||
),
|
|
||||||
W.RawLabel('%{r}'),
|
W.RawLabel('%{r}'),
|
||||||
conky.ConkyWidget(text= conky_text),
|
grey_frame(W.DateTime('%d. %B, %H:%M')),
|
||||||
# something like a tabbed widget with the tab labels '>' and '<'
|
|
||||||
W.ShortLongLayout(
|
|
||||||
W.RawLabel(''),
|
|
||||||
W.ListLayout([
|
|
||||||
hlwm.HLWMLayoutSwitcher(hc, xkblayouts, command = setxkbmap.split(' ')),
|
|
||||||
W.RawLabel(' '),
|
|
||||||
])),
|
|
||||||
grey_frame(W.DateTime('%d. %B, %H:%M')),
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue