summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpanel.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/panel.py b/panel.py
index 7130b3f..467daa3 100755
--- a/panel.py
+++ b/panel.py
@@ -180,7 +180,7 @@ class ModHLWMTags(ModHLWMBase):
def post_start(self):
self.refresh()
- def fmt_tag(self, sym, tag, tagstr):
+ def fmt_tag(self, sym, tag, focused):
disp = Fmt.pad(tag)
match sym:
case '.':
@@ -188,25 +188,26 @@ class ModHLWMTags(ModHLWMBase):
case '#':
buf = Fmt.bg('#333333', Fmt.ul('#7b51ca', Fmt.bold(disp)))
case '!':
- if '#' in tagstr:
- buf = Fmt.bg('#a03000', Fmt.ul('#000000', disp))
- else:
- buf = Fmt.bg('#a03000', Fmt.ul('#7b51ca', Fmt.bold(disp)))
+ buf = Fmt.bg(
+ '#a03000',
+ Fmt.ul('#7b51ca', Fmt.bold(disp))
+ if tag == focused
+ else Fmt.ul('#000000', disp))
case ':':
buf = disp
return Fmt.clickable('', f'{id(self)} use {tag}', buf)
def refresh(self):
- tagstr = self.hc('tag_status')
- tags = tagstr.lstrip('\t').split('\t')
+ tags = self.hc('tag_status').lstrip('\t').split('\t')
+ focused = self.hc('attr', 'tags.focus.name')
self.out = Fmt.clickable(
4, f'{id(self)} use_index +1',
Fmt.clickable(
5, f'{id(self)} use_index -1',
''.join(
- self.fmt_tag(tag[0], tag[1:], tagstr) for tag in tags)))
+ self.fmt_tag(tag[0], tag[1:], focused) for tag in tags)))
self.repaint()
def process_cmd(self, cmd):