added set volume by number
This commit is contained in:
parent
894a1ae5e0
commit
273e3cb436
3 changed files with 26 additions and 13 deletions
|
@ -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.
|
||||
|
||||
### 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.
|
||||
|
|
0
fuzzytime.nim
Executable file → Normal file
0
fuzzytime.nim
Executable file → Normal file
36
volume.nim
Executable file → Normal file
36
volume.nim
Executable file → Normal file
|
@ -59,20 +59,30 @@ proc get_volume*(run_once: bool = false) =
|
|||
data.selected_color = black
|
||||
let args = @["up", "down", "mute", "ncpamixer", "pavucontrol"]
|
||||
let option = outputJSON(data,args)
|
||||
case option:
|
||||
of "up":
|
||||
discard execCmd("pamixer -i 5")
|
||||
if option in args:
|
||||
case option:
|
||||
of "up":
|
||||
discard execCmd("pamixer -i 5")
|
||||
get_volume()
|
||||
of "down":
|
||||
discard execCmd("pamixer -d 5")
|
||||
get_volume()
|
||||
of "mute":
|
||||
discard execCmd("pamixer -t")
|
||||
get_volume()
|
||||
of "ncpamixer":
|
||||
discard execCmd("ncpamixer")
|
||||
of "pavucontrol":
|
||||
discard execCmd("pavucontrol")
|
||||
else:
|
||||
try:
|
||||
let vol = parseInt(option)
|
||||
discard execCmd("pamixer --set-volume " & $vol)
|
||||
get_volume()
|
||||
of "down":
|
||||
discard execCmd("pamixer -d 5")
|
||||
get_volume()
|
||||
of "mute":
|
||||
discard execCmd("pamixer -t")
|
||||
get_volume()
|
||||
of "ncpamixer":
|
||||
discard execCmd("ncpamixer")
|
||||
of "pavucontrol":
|
||||
discard execCmd("pavucontrol")
|
||||
except:
|
||||
echo getCurrentExceptionMsg()
|
||||
|
||||
|
||||
|
||||
|
||||
if run_once:
|
||||
|
|
Loading…
Reference in a new issue