annotate bin/swapscreens.sh @ 325:bc2d0d504270

preserve mode (could, in theory, take from script)
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 08 Jun 2013 08:42:21 -0700
parents 206d7550bf45
children 71345f4de3ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
139
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/bin/bash
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 # swap screens between internal laptop monitor and external monitor
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 INTERNAL="LVDS1"
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 EXTERNAL="VGA1"
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 INTERNAL_MODE="1366x768"
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 EXTERNAL_MODE="1600x1200"
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 xwininfo -root | grep "geometry $EXTERNAL_MODE"
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 if [ $? -eq 0 ]
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12 then
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 xrandr --output $EXTERNAL --off --output $INTERNAL --mode $INTERNAL_MODE
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 else
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 xrandr --output $INTERNAL --off --output $EXTERNAL --mode $EXTERNAL_MODE
206d7550bf45 add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 fi