Skip to content

Instantly share code, notes, and snippets.

@Ajnasz
Created August 27, 2013 17:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Ajnasz/6356647 to your computer and use it in GitHub Desktop.
Save Ajnasz/6356647 to your computer and use it in GitHub Desktop.
#!/bin/sh
IN=LVDS-0;
setoff() {
for display in `xrandr | awk '/ disconnected/ {print $1}'`; do
echo "maybe disabling $display";
xrandr --output $display --off;
done;
}
seton() {
CMD="xrandr --output $IN --auto --primary";
for display in `xrandr | awk '/ connected/ {print $1}'`; do
if [ "$display" != "$IN" ]; then
CMD="$CMD --output $display --auto --right-of $IN";
fi
done;
echo $CMD;
$CMD;
}
setoff;
seton;
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment