diff --git a/home/dot_config/hypr/keybinds.conf b/home/dot_config/hypr/keybinds.conf index 7339b013..c2976296 100644 --- a/home/dot_config/hypr/keybinds.conf +++ b/home/dot_config/hypr/keybinds.conf @@ -21,6 +21,7 @@ binde = , l, resizeactive, 50 0 bind = , 1, exec, ~/.config/hypr/scripts/audio-device-switcher.sh 1 $e bind = , 2, exec, ~/.config/hypr/scripts/audio-device-switcher.sh 2 $e bind = , 3, exec, ~/.config/hypr/scripts/audio-device-switcher.sh 3 $e +bind = , 0, exec, ~/.config/hypr/scripts/audio-device-switcher.sh 0 $e bind = , escape, submap, reset submap = reset diff --git a/home/dot_config/hypr/scripts/executable_audio-device-switcher.sh b/home/dot_config/hypr/scripts/executable_audio-device-switcher.sh index 7a242a16..a2f28040 100644 --- a/home/dot_config/hypr/scripts/executable_audio-device-switcher.sh +++ b/home/dot_config/hypr/scripts/executable_audio-device-switcher.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash # -sink=$(pactl list sinks | grep "Sink #" | head -n $1 | tail -n 1) -card=$(pactl list sinks | grep "alsa.card_name" | head -n $1 | tail -n 1) -pactl set-default-sink $(echo $sink | cut -d "#" -f 2) -notify-send "$(echo $card | cut -d "\"" -f 2)" +if [[ $1 -eq 0 ]]; then + notify-send "$(pactl list sinks | awk -F': ' '/State:.*RUNNING/{getline; getline; sub("^[ \t]+", "", $2); print "Active Sink: " $2}')" +else + sink=$(pactl list sinks | grep "Sink #" | head -n $1 | tail -n 1) + card=$(pactl list sinks | grep "alsa.card_name" | head -n $1 | tail -n 1) + pactl set-default-sink $(echo $sink | cut -d "#" -f 2) + notify-send "Active Sink: $(echo $card | cut -d "\"" -f 2)" +fi