From ce70addd5b17da95a6e05c1fb1e94cb03944d99d Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 10 Nov 2026 18:28:20 +0100 Subject: feat(music): a volume slider with a mute toggle, icon buttons The Vol-, Mute and Vol+ buttons give way to a mute toggle (its icon shows the state) and a 0-100 slider that sets the default sink with wpctl as it moves. Previous, play/pause and next are Nerd Font glyphs instead of the tablet's Unicode symbols. Co-Authored-By: Claude Opus 5.5 --- tests/test_music.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/test_music.py b/tests/test_music.py index ccf0539..aadfcc5 100644 --- a/tests/test_music.py +++ b/tests/test_music.py @@ -53,6 +53,15 @@ class Music(unittest.TestCase): with self.assertRaises(music.ModuleError, msg=bad): m.actions["seek"](bad) + def test_volume_sets_the_sink(self): + calls = [] + m = music.make({"run": lambda *a, **k: "", "popen": calls.append}) + m.actions["volume"]({"level": 45}) + self.assertEqual(calls[0], ["wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "0.45"]) + for bad in ({}, {"level": 101}, {"level": -1}, {"level": "5"}, {"level": True}): + with self.assertRaises(music.ModuleError, msg=bad): + m.actions["volume"](bad) + if __name__ == "__main__": unittest.main() -- cgit v1.2.3