示例#1
0
def main():
    hc = hlwm.connect()
    monitor = int(sys.argv[1]) if len(sys.argv) >= 2 else 0

    x, y, monitor_w, _monitor_h = hc.monitor_rect(monitor)
    geom = Geometry(x, y, width=monitor_w, height=16)
    hc(['pad', str(monitor), str(geom.height)])

    cg = conky.ConkyGenerator(lemonbar.textpainter())
    cg_cpu(cg)
    cg_space(cg)
    cg_fan(cg)
    cg_temp(cg)
    cg_net(cg)
    cg_battery(cg)
    cg_time(cg)

    conky_config = {
        'update_interval': '1',
        'update_interval_on_battery': '10',
    }

    trayer_config = {
        'tint': Gruv.BG.replace('#', '0x'),
        'iconspacing': '5',
        'padding': '5'
    }

    bar = lemonbar.Lemonbar(geometry=geom,
                            foreground=Gruv.FG,
                            background=Gruv.BG)

    title_theme = core.Theme(fg=Gruv.FG4, padding=(40, 0))

    left_widgets = [
        hlwm.HLWMTags(hc, monitor, tag_renderer=tag_renderer),
        title_theme(hlwm.HLWMWindowTitle(hc)),
    ]
    right_widgets = [
        conky.ConkyWidget(text=str(cg), config=conky_config),
    ]
    if monitor == 0:
        right_widgets.append(trayer.TrayerWidget(args=trayer_config))

    bar.widget = widgets.ListLayout([
        widgets.RawLabel('%{l}'),
        *left_widgets,
        widgets.RawLabel('%{r}'),
        *right_widgets,
    ])
    return bar
示例#2
0
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

# Copy this config to ~/.config/barpyrus/config.py

# set up a connection to herbstluftwm in order to get events
# and in order to call herbstclient commands
hc = hlwm.connect()

# get the geometry of the monitor
monitor = sys.argv[1] if len(sys.argv) >= 2 else 0
(x, y, monitor_w, monitor_h) = hc.monitor_rect(monitor)
height = 16  # height of the panel
width = monitor_w  # width of the panel
hc(['pad', str(monitor), str(height)])  # get space for the panel

# you can define custom themes
grey_frame = Theme(bg='#303030', fg='#EFEFEF', padding=(3, 3))

# Widget configuration:
bar = lemonbar.Lemonbar(geometry=(x, y, width, height))
bar.widget = W.ListLayout([
    W.RawLabel('%{l}'),
    hlwm.HLWMTags(hc, monitor),
    W.RawLabel('%{c}'),
    grey_frame(hlwm.HLWMWindowTitle(hc)),
    W.RawLabel('%{r}'),
示例#3
0
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

# Copy this config to ~/.config/barpyrus/config.py

# set up a connection to herbstluftwm in order to get events
# and in order to call herbstclient commands
hc = hlwm.connect()

# get the geometry of the monitor
monitor = sys.argv[1] if len(sys.argv) >= 2 else 0
(x, y, monitor_w, monitor_h) = hc.monitor_rect(monitor)
height = 16 # height of the panel
width = monitor_w # width of the panel
hc(['pad', str(monitor), str(height)]) # get space for the panel

# you can define custom themes
grey_frame = Theme(bg = '#303030', fg = '#EFEFEF', padding = (3,3))

# Widget configuration:
bar = lemonbar.Lemonbar(geometry = (x,y,width,height))
bar.widget = W.ListLayout([
    W.RawLabel('%{l}'),
    hlwm.HLWMTags(hc, monitor),
    W.RawLabel('%{c}'),
    grey_frame(hlwm.HLWMWindowTitle(hc)),
    W.RawLabel('%{r}'),