summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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',