Skip to content

Instantly share code, notes, and snippets.

@ronihcohen
Last active August 29, 2015 14:02
Show Gist options
  • Save ronihcohen/d2e07e0b2043845e6a94 to your computer and use it in GitHub Desktop.
Save ronihcohen/d2e07e0b2043845e6a94 to your computer and use it in GitHub Desktop.
Ubuntu toggle HDMI display + sound output.
#!/bin/sh
# This shell script is PUBLIC DOMAIN. You may do whatever you want with it.
TOGGLE=$HOME/.toggle
if [ ! -e $TOGGLE ]; then
touch $TOGGLE
xrandr --output HDMI2 --auto --left-of VGA1
pactl set-card-profile 0 output:hdmi-stereo-extra2
else
rm $TOGGLE
xrandr --output HDMI2 --off
pactl set-card-profile 0 output:analog-stereo
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment