Skip to content

Instantly share code, notes, and snippets.

@Ajnasz
Created Jul 14, 2014
Embed
What would you like to do?
#!/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