Skip to content

NoSpawnn/dotfiles

Repository files navigation

NoSpawnn/dotfiles

Dotfiles managed using GNU Stow

FAQ

  • What the hell is that command in your waybar config?
    • I assume you mean this:

      pactl list short sinks | awk '{print $2}' | awk -v current=\"$(pactl get-default-sink)\" 'BEGIN{found=0} {sinks[NR]=$1} END{for(i=1;i<=NR;i++){if(sinks[i]==current){next_sink=sinks[(i%NR)+1]; break}} print next_sink}' | xargs -r pactl set-default-sink && pactl list short sink-inputs | awk '{print $1}' | xargs -I{} pactl move-sink-input {} $(pactl get-default-sink)
    • It switches to the "next" audio device according to pactl, the order of devices is decided by the output for pactl list sinks

    • I'll explain the command:

      • First, get the names of all pulseaudio sinks, this extracts the 2nd column (whitespace separated) from the output of the pactl command

        $ pactl list short sinks | awk '{print $2}'
        alsa_output.usb-SteelSeries_Arctis_Nova_Pro_Wireless-00.analog-stereo
        alsa_output.pci-0000_0f_00.6.iec958-stereo
        bluez_output.40_72_18_F0_37_3E.1
      • Then:

        • Get the default (current) sink and assign it to current

        • Iterate through the sinks until we find the current one, wrapping around to the start if we need to (i % NR + 1)

        • Output the name of that sink

          awk -v current=\"$(pactl get-default-sink)\" 'BEGIN{found=0} {sinks[NR]=$1} END{for(i=1;i<=NR;i++){if(sinks[i]==current){next_sink=sinks[(i%NR)+1]; break}} print next_sink}'
      • Finally, pipe that into pactl set-default-sink through xargs, and move all active sources to that new sink

        xargs -r pactl set-default-sink && pactl list short sink-inputs | awk '{print $1}' | xargs -I{} pactl move-sink-input {} $(pactl get-default-sink)

References, Inspiration, etc

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published