works
This commit is contained in:
commit
6895754dfe
3 changed files with 30 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/.venv
|
28
main.py
Executable file
28
main.py
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/home/ardent/virtualenvs/kroqnroll/bin/python3
|
||||
|
||||
from pulsectl import Pulse
|
||||
import sys
|
||||
|
||||
with Pulse('kroq-volume') as pulse:
|
||||
inputs = pulse.sink_input_list()
|
||||
|
||||
inputs = [input for input in inputs if "nrsc5" in input.name]
|
||||
if len(inputs) < 1 or len(sys.argv) < 2:
|
||||
sys.exit(0)
|
||||
kroq = inputs[0]
|
||||
vol = kroq.volume.value_flat
|
||||
command = sys.argv[1].strip()
|
||||
|
||||
if command == "up":
|
||||
vol = vol + 0.1
|
||||
vol = min(vol, 1.0)
|
||||
if command == "down":
|
||||
vol = vol - 0.1
|
||||
vol = max(vol, 0.0)
|
||||
if command == "mute":
|
||||
kroq.mute = not kroq.mute
|
||||
|
||||
kroq.volume.value_flat = vol
|
||||
|
||||
pulse.sink_input_mute(kroq.index, kroq.mute)
|
||||
pulse.volume_set(kroq, kroq.volume)
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
pulsectl==23.5.2
|
Loading…
Reference in a new issue