summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpanel.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/panel.py b/panel.py
index 0248838..17c41ca 100755
--- a/panel.py
+++ b/panel.py
@@ -181,7 +181,8 @@ class HLWMClient():
else:
self.listeners[hook] = [d]
- def exec(self, *args):
+ @staticmethod
+ def exec(*args):
res = subprocess.run(
('herbstclient', *args),
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True)
@@ -394,7 +395,7 @@ class ModMem(ModInterval):
self.out = Fmt.labelled('MEM', f'{percent:.0f}%%')
class Panel:
- def __init__(self, *mods, max_paint_delay=0):
+ def __init__(self, *mods, max_paint_delay=0, width=1920, height=22):
self.e_repaint = threading.Event()
self.e_flush = threading.Event()
self.mods = mods
@@ -403,6 +404,8 @@ class Panel:
m.e_flush = self.e_flush
self.mod_by_id = {id(m): m for m in self.mods}
self.max_paint_delay = max_paint_delay
+ self.width = width
+ self.height = height
def process_cmds(self, pipe):
while True:
@@ -421,7 +424,8 @@ class Panel:
('/home/david/lemonbar-xft/lemonbar',
'-bf', 'Monospace:size=10:dpi=96',
'-f', 'Monospace:size=10:dpi=96:bold',
- '-u', '2', '-g', '1920x22', '-a', '100'),
+ '-g', f'{self.width}x{self.height}',
+ '-u', '2', '-a', '100'),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
text=True)
@@ -461,5 +465,7 @@ Panel(
fmts=('%Y-%m-%d %H:%M:%S', '%H:%M'),
tzs=({'id': None}, {'id': 'UTC'},
{'id': 'Asia/Yerevan', 'label': 'AMT'})),
- max_paint_delay=0.01
+ max_paint_delay=0.01,
+ width=(re.match('[0-9]+', HLWMClient.exec('attr', 'monitors.0.geometry'))
+ .group())
).run()