diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2024-03-08 14:07:35 -0800 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2024-03-08 14:07:35 -0800 |
commit | ca7fc08d5219dc6c33f67d4e39317aade4490575 (patch) | |
tree | 5532f16950fe7077ee0e5f4905b8c9a63adce86a | |
parent | 95007a6eb03c495afcbcdfed09a48cf50b511374 (diff) | |
download | panel-ca7fc08d5219dc6c33f67d4e39317aade4490575.tar.gz panel-ca7fc08d5219dc6c33f67d4e39317aade4490575.tar.xz |
support volume adjustments via mouse
-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): |