From 9f36ecab7b566f36290db6a4df7801e476b7c914 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 19 Feb 2024 00:19:05 -0800 Subject: correctly indicate focused urgent tag when multiple urgent --- panel.py | 17 +++++++++-------- 1 file 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): -- cgit v1.2.3-70-g09d2