summaryrefslogtreecommitdiff
path: root/panel.py
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2024-03-08 14:07:35 -0800
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2024-03-08 14:07:35 -0800
commitca7fc08d5219dc6c33f67d4e39317aade4490575 (patch)
tree5532f16950fe7077ee0e5f4905b8c9a63adce86a /panel.py
parent95007a6eb03c495afcbcdfed09a48cf50b511374 (diff)
downloadpanel-ca7fc08d5219dc6c33f67d4e39317aade4490575.tar.gz
panel-ca7fc08d5219dc6c33f67d4e39317aade4490575.tar.xz
support volume adjustments via mouse
Diffstat (limited to 'panel.py')
-rwxr-xr-xpanel.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/panel.py b/panel.py
index 4c9decd..59d4874 100755
--- a/panel.py
+++ b/panel.py
@@ -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):