Skip to content

Instantly share code, notes, and snippets.

@zmpeg
Last active December 15, 2015 19:48
Show Gist options
  • Save zmpeg/5313531 to your computer and use it in GitHub Desktop.
Save zmpeg/5313531 to your computer and use it in GitHub Desktop.
extend desktop with xrandr. Usage: ./extend.sh [dir] where [dir] is 'left' or 'right' or 'clone'
#!/bin/sh
if [ -z "$1" ]; then
xrandr --output HDMI1 --mode 0x0
else
RES=`xrandr | grep -A1 HDMI1 | tail -n1 | awk '{ print $1 }'`
echo "Detected HDMI1 with resolution ${RES}"
echo "xrandr --output HDMI1 --mode ${RES}"
xrandr --output HDMI1 --mode $RES
sleep 1
xrandr --output HDMI1 --right-of eDP1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment