Skip to content

Instantly share code, notes, and snippets.

@yoyosan
Last active May 19, 2021 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoyosan/ea539c46fca501ee12492393ea3c7958 to your computer and use it in GitHub Desktop.
Save yoyosan/ea539c46fca501ee12492393ea3c7958 to your computer and use it in GitHub Desktop.
Example scripts of switching HDMI outputs when using Pipewire
#!/bin/bash
hdmi="$(pactl list sinks|grep Name|grep hdmi|sed 's/Name: //'|sed 's/\s//')"
pactl set-default-sink "$hdmi"
pactl set-sink-port "$hdmi" hdmi-output-2
pactl set-card-profile alsa_card.pci-0000_0b_00.1 output:hdmi-stereo-extra2
pactl set-sink-volume @DEFAULT_SINK@ 50%
# obtain ports: pactl list
# my ports: hdmi-output-1, hdmi-output-2
# After sleep, the card profile changes for `fuck knows` what reason
# so I use this version:
hdmi="$(pactl list sinks|grep Name|grep hdmi|sed 's/Name: //'|sed 's/\s//')"
pactl set-default-sink "$hdmi"
pactl set-sink-port "$hdmi" hdmi-output-2
pactl set-card-profile alsa_card.pci-0000_0b_00.1 output:hdmi-stereo-extra1
pactl set-sink-volume @DEFAULT_SINK@ 50%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment