# Conflicts: # .config/hypr/hyprland.conf # .config/hypr/hyprpaper.conf # .config/waybar/config # .gitignore # .zshrc # bin/alias # bin/brightness # bin/cycle_pactl.sh # bin/keep.sh # bin/lid_close.sh # bin/lid_open.sh # bin/startup.sh
38 lines
1017 B
Bash
Executable File
38 lines
1017 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
default_sink=$(pactl info | grep "Default Sink:" | cut '-d ' -f3)
|
|
sinks=$(pactl list short sinks | cut -f2 | grep -v "^easyeffects_sink$")
|
|
|
|
# Only sinks that are available (not "not available")
|
|
sinks=$(pactl list sinks | awk '
|
|
$1=="Name:" {name=$2}
|
|
$1=="State:" {state=$2}
|
|
$1=="Availability:" {avail=$2}
|
|
$1=="" {
|
|
if (avail != "not") print name
|
|
name=state=avail=""
|
|
}
|
|
' | grep -Ev '(^easyeffects_sink$|HDMI)')
|
|
|
|
sinks=$(pactl list short sinks | cut -f2 | grep -Ev '(^easyeffects_sink$|HDMI|skl_hda_dsp_generic)')
|
|
|
|
# for wrap-around
|
|
sinks="$sinks
|
|
$sinks"
|
|
|
|
next_sink=$(echo "$sinks" | awk -v ds="$default_sink" '$0==ds {getline x; print x; exit}')
|
|
|
|
if [ -z "$next_sink" ]; then
|
|
next_sink=$(echo "$sinks" | head -n 1)
|
|
fi
|
|
|
|
echo "Setting output to $next_sink"
|
|
pactl set-default-sink "$next_sink"
|
|
|
|
easyeffects_id=$(pactl list short sinks | awk '$2=="easyeffects_sink" {print $1; exit}')
|
|
pactl list short sink-inputs | \
|
|
cut -f1 | \
|
|
xargs -I{} pactl move-sink-input {} "$next_sink"
|
|
|