diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2024-02-19 00:19:05 -0800 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2024-02-19 00:19:05 -0800 |
commit | 9f36ecab7b566f36290db6a4df7801e476b7c914 (patch) | |
tree | 1eaa6c1ec40caea4fe77f2e2adcdac11d8e6081d | |
parent | 61263de56df6872bf85346f05d425bf640da6571 (diff) | |
download | panel-9f36ecab7b566f36290db6a4df7801e476b7c914.tar.gz panel-9f36ecab7b566f36290db6a4df7801e476b7c914.tar.xz |
correctly indicate focused urgent tag when multiple urgent
-rwxr-xr-x | panel.py | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -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): |