added set volume by number

This commit is contained in:
Paul Wilde 2022-05-01 18:05:31 +01:00
parent 894a1ae5e0
commit 273e3cb436
3 changed files with 26 additions and 13 deletions

View file

@ -32,4 +32,7 @@ There's also an i3bar_tools_threaded folder with tools for use with i3bar/i3bloc
These have some configuration variables explicit to me, you'll need to change them for you for them to be useful I imagine. These have some configuration variables explicit to me, you'll need to change them for you for them to be useful I imagine.
### Dependencies
- dmenu, rofi, or i3bar (with i3blocks)
I'm aware my code is messy. I'm aware my code is undocumented. But hopefully these things are simple enough to work out. I'm aware my code is messy. I'm aware my code is undocumented. But hopefully these things are simple enough to work out.

0
fuzzytime.nim Executable file → Normal file
View file

10
volume.nim Executable file → Normal file
View file

@ -59,6 +59,7 @@ proc get_volume*(run_once: bool = false) =
data.selected_color = black data.selected_color = black
let args = @["up", "down", "mute", "ncpamixer", "pavucontrol"] let args = @["up", "down", "mute", "ncpamixer", "pavucontrol"]
let option = outputJSON(data,args) let option = outputJSON(data,args)
if option in args:
case option: case option:
of "up": of "up":
discard execCmd("pamixer -i 5") discard execCmd("pamixer -i 5")
@ -73,6 +74,15 @@ proc get_volume*(run_once: bool = false) =
discard execCmd("ncpamixer") discard execCmd("ncpamixer")
of "pavucontrol": of "pavucontrol":
discard execCmd("pavucontrol") discard execCmd("pavucontrol")
else:
try:
let vol = parseInt(option)
discard execCmd("pamixer --set-volume " & $vol)
get_volume()
except:
echo getCurrentExceptionMsg()
if run_once: if run_once: