Skip to content

Instantly share code, notes, and snippets.

@Ajnasz
Created July 14, 2014 15:49
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 Ajnasz/c4faea76a28758c7f0b7 to your computer and use it in GitHub Desktop.
Save Ajnasz/c4faea76a28758c7f0b7 to your computer and use it in GitHub Desktop.
#!/bin/sh
# IN=LVDS-0;
IN=eDP1
LASTDISPLAY=$IN
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 $LASTDISPLAY";
LASTDISPLAY=$display
fi
done;
echo $CMD
$CMD
}
setoff;
# seton;
xrandr --output eDP1 --auto --primary --output DP1 --auto --right-of eDP1 --output VGA1 --auto --right-of DP1
exit $?;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment