Exemplo n.º 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
Exemplo n.º 2
0
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}'),
    conky.ConkyWidget('df /: ${fs_used_perc /}%'),
    grey_frame(W.DateTime('%d. %B, %H:%M')),
])
Exemplo n.º 3
0
bar = lemonbar.Lemonbar(**lemonbar_options)

bar.widget = W.ListLayout([
    W.RawLabel('%{l}'),
    hlwm.HLWMTags(hc, monitor, tag_renderer=tag_renderer),
    W.TabbedLayout(
        list(
            enumerate([
                W.ListLayout([
                    W.RawLabel('%{c}'),
                    hlwm.HLWMMonitorFocusLayout(
                        hc,
                        monitor,
                        # this widget is shown on the focused monitor:
                        grey_frame(hlwm.HLWMWindowTitle(hc, maxlen=70)),
                        # this widget is shown on all unfocused monitors:
                        conky_widget,
                    )
                ]),
                #   W.ListLayout([ W.RawLabel('%{c}'), conky_widget ]),
            ])),
        tab_renderer=tab_renderer),
    W.RawLabel('%{r}'),
    # something like a tabbed widget with the tab labels '>' and '<'
    #    W.TabbedLayout([
    #        ('0', W.RawLabel('')),
    #        ('1', hlwm.HLWMLayoutSwitcher(hc, xkblayouts, command = setxkbmap.split(' '))),
    #        ], tab_renderer = zip_renderer),
    #    conky.ConkyWidget('df /: ${fs_used_perc /}%'),
    #    W.RawLabel(' '),