diff options
-rwxr-xr-x | panel.py | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -478,7 +478,22 @@ class ModPWVol(ModInterval): buf += ' [muted]' else: buf = Fmt.bg('#a03000', ' error ') - self.out = Fmt.labelled('VOL', buf) + + self.out = Fmt.clickable( + 4, f'{id(self)} set 0.05+', + Fmt.clickable( + 5, f'{id(self)} set 0.05-', + Fmt.clickable( + '', f'{id(self)} toggle-mute', + Fmt.labelled('VOL', buf)))) + + def process_cmd(self, cmd): + if cmd == 'toggle-mute': + subprocess.run(('wpctl', 'set-mute', self.sink, 'toggle')) + elif cmd.startswith('set'): + subprocess.run(('wpctl', 'set-volume', self.sink, cmd[4:])) + self.refresh() + self.repaint() class Panel: def __init__(self, *mods, max_paint_delay=0, width=1920, height=22): |