Who doesn’t love using the keyboard even for simple things like switching the output (or sink as pulseaudio calls it) for you audio? My setup is a set of external speakers, a monitor with rather bad speakers and plugged into the monitor at all time my headphones. That makes three sinks which makes my script a bit more complicated than a simple toggle to the other (i.e. IDLE sink) would be. The obvious other use-case for this script is one systems where you don’t have a display. #!/bin/env sh # get the names and give each a number sinks=`pactl list sinks | grep Name | grep -n Name` # echo with " to get the newlins properly and find which we currently use current_sink_number=`echo "$sinks" | grep "\$(pactl get-default-sink)" | cut -d: -f 1` # modulo on current sink + 1 new_sink_number=$((($current_sink_number % `echo "$sinks" | wc -l`) + 1)) # find id of the next sink new_sink=`echo "$sinks" | sed -En "/$new_sink_number:/ s/.*Name: (.*)/\1/p;"` pactl set-default-sink $new_sink # get…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.