summaryrefslogtreecommitdiff
path: root/panel.py
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2024-02-19 13:49:26 -0800
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2024-02-19 13:49:26 -0800
commitd9d5397f360b7b57353c381a9bbbe2e283650439 (patch)
treef94df925afbf51db1d3ab2ad031bc41ae133e001 /panel.py
parentf8ff429d392e10fbbb057c504dc9e51b4b0734ea (diff)
downloadpanel-d9d5397f360b7b57353c381a9bbbe2e283650439.tar.gz
panel-d9d5397f360b7b57353c381a9bbbe2e283650439.tar.xz
make max title length configurable
Diffstat (limited to 'panel.py')
-rwxr-xr-xpanel.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/panel.py b/panel.py
index 10abafe..32fc037 100755
--- a/panel.py
+++ b/panel.py
@@ -229,8 +229,9 @@ class ModHLWMTags(ModHLWMBase):
subprocess.run(('herbstclient', *cmd.split()))
class ModHLWMTitle(ModHLWMBase):
- def __init__(self, **kwargs):
+ def __init__(self, max_len=None, **kwargs):
super().__init__(**kwargs)
+ self.max_len = max_len
self.listen('focus_changed', self.refresh)
self.listen('window_title_changed', self.refresh)
@@ -239,7 +240,10 @@ class ModHLWMTitle(ModHLWMBase):
def refresh(self):
title = self.hc('attr', 'clients.focus.title')
- self.out = title if len(title) < 65 else title[0:63] + '…'
+ self.out = (
+ title[0:self.max_len-1] + '…'
+ if self.max_len and len(title) > self.max_len
+ else title)
self.repaint()
class ModInputUnavail(Mod):
@@ -330,7 +334,7 @@ class Panel:
Panel(
ModHLWMTags(spacing=0),
- ModHLWMTitle(),
+ ModHLWMTitle(max_len=96),
ModRight(),
ModInputUnavail(
'/dev/input/by-id/usb-HID_Keyboard_HID_Keyboard-event-kbd',