reworked swaylock and some other stuff
This commit is contained in:
parent
482c323367
commit
b8c24493ca
5 changed files with 62 additions and 15 deletions
|
|
@ -28,16 +28,60 @@ function open_location
|
|||
end
|
||||
end
|
||||
|
||||
set options " Open Location" " Clear Playlist" " Lock"
|
||||
function audio_source
|
||||
set dump (string trim -c '"' (pw-dump | jq '.[] | select(.info.props."media.class" == "Audio/Source")' | jq '.id, .info.props."node.nick"'))
|
||||
|
||||
set ids
|
||||
set names
|
||||
|
||||
for i in (seq (count $dump))
|
||||
if test (math $i % 2) -eq 0
|
||||
set -a names $dump[$i]
|
||||
else
|
||||
set -a ids $dump[$i]
|
||||
end
|
||||
end
|
||||
|
||||
set input (menu $names)
|
||||
|
||||
wpctl set-default $ids[(contains -i $input $names)]
|
||||
end
|
||||
|
||||
function audio_sink
|
||||
set dump (string trim -c '"' (pw-dump | jq '.[] | select(.info.props."media.class" == "Audio/Sink")' | jq '.id, .info.props."node.nick"'))
|
||||
|
||||
set ids
|
||||
set names
|
||||
|
||||
for i in (seq (count $dump))
|
||||
if test (math $i % 2) -eq 0
|
||||
set -a names $dump[$i]
|
||||
else
|
||||
set -a ids $dump[$i]
|
||||
end
|
||||
end
|
||||
|
||||
set input (menu $names)
|
||||
|
||||
wpctl set-default $ids[(contains -i $input $names)]
|
||||
end
|
||||
|
||||
set options " Open Location" " Clear Playlist" " Lock" " Select Audio Source" " Select Audio Sink"
|
||||
set input (menu $options)
|
||||
|
||||
switch $input
|
||||
case $options[1]
|
||||
open_location
|
||||
open_location
|
||||
|
||||
case $options[2]
|
||||
mpc clear
|
||||
mpc clear
|
||||
|
||||
case $options[3]
|
||||
exec swaylock
|
||||
exec swaylock
|
||||
|
||||
case $options[4]
|
||||
audio_source
|
||||
|
||||
case $options[5]
|
||||
audio_sink
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue