Skip to content

Instantly share code, notes, and snippets.

@kstep
Created March 9, 2012 18:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kstep/2008005 to your computer and use it in GitHub Desktop.
Save kstep/2008005 to your computer and use it in GitHub Desktop.
autoconfigure displays layout with xrandr
#!/bin/sh
case "$1" in
left-of|right-of|above|below|same-as) D=$1 ;;
*) D=left-of ;;
esac
xrandr | awk -v dir=$D 'out { gsub("[^0-9.]", "", $2); print "--output " out " --mode " $1 " --rate " $2 pout; pout=" --" dir " " out; out=0 } / connected/ { out=$1 }' | xargs xrandr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment