added scripts folder to gitea
This commit is contained in:
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
CARD="alsa_card.pci-0000_04_00.1"
|
||||
|
||||
# Rofi menu with extra options + fixed bindings to avoid "failed to set binding"
|
||||
CHOICE=$(echo -e "HDMI 0 (CRT)\nHDMI 5 (HDTV)" | \
|
||||
rofi -dmenu \
|
||||
-p "HDMI Audio Output" \
|
||||
-mesg "Toggle between your two HDMI monitors" \
|
||||
-i \
|
||||
-no-custom \
|
||||
-theme-str 'window {width: 420px;}' \
|
||||
-theme-str 'listview {lines: 4;}' \
|
||||
-kb-row-up "Up,Control+p" \
|
||||
-kb-row-down "Down,Control+n" \
|
||||
-kb-accept-entry "Return,KP_Enter" \
|
||||
-kb-cancel "Escape,Control+g,Control+bracketleft" \
|
||||
-kb-mode-next "" \ # disable problematic defaults
|
||||
-kb-mode-previous "" )
|
||||
|
||||
case "$CHOICE" in
|
||||
"HDMI 0 (CRT)")
|
||||
pactl set-card-profile "$CARD" output:hdmi-stereo
|
||||
notify-send "Audio Switch" "Switched to HDMI 0" -i audio-card
|
||||
;;
|
||||
"HDMI 5 (HDTV)")
|
||||
pactl set-card-profile "$CARD" output:hdmi-stereo-extra4
|
||||
notify-send "Audio Switch" "Switched to HDMI 5" -i audio-card
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# Small delay + move all running audio streams to the new sink
|
||||
sleep 0.5
|
||||
NEW_SINK=$(pactl list short sinks | grep -E 'hdmi-stereo' | awk '{print $2}' | head -1)
|
||||
pactl set-default-sink $NEW_SINK
|
||||
#pactl list short sink-inputs | awk '{print $1}' | xargs -r -I {} pactl move-sink-input {} "$NEW_SINK" 2>/dev/null
|
||||
|
||||
Reference in New Issue
Block a user