Mercurial > hg > config
annotate bin/swapscreens.sh @ 684:8b2787e98c01
STUB: python/gview.py
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sat, 17 May 2014 20:10:47 -0700 |
parents | 71345f4de3ce |
children |
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 |
343
71345f4de3ce
programs to list make targets
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
4 # XXX sensitive to the individual laptop :( |
71345f4de3ce
programs to list make targets
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
5 |
71345f4de3ce
programs to list make targets
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
6 # See also `unxrandr`: |
71345f4de3ce
programs to list make targets
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
7 # unxrandr - inverse tool of xrandr |
71345f4de3ce
programs to list make targets
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
8 # unxrandr is a tool that queries the XRandR state using ARandR's |
71345f4de3ce
programs to list make targets
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
9 # libraries and outputs an xrandr command line that reproduces the state |
71345f4de3ce
programs to list make targets
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
10 |
139
206d7550bf45
add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
11 |
206d7550bf45
add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
12 INTERNAL="LVDS1" |
206d7550bf45
add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
13 EXTERNAL="VGA1" |
206d7550bf45
add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
14 INTERNAL_MODE="1366x768" |
206d7550bf45
add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
15 EXTERNAL_MODE="1600x1200" |
206d7550bf45
add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
16 |
206d7550bf45
add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
17 xwininfo -root | grep "geometry $EXTERNAL_MODE" |
206d7550bf45
add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
18 if [ $? -eq 0 ] |
206d7550bf45
add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
19 then |
206d7550bf45
add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
20 xrandr --output $EXTERNAL --off --output $INTERNAL --mode $INTERNAL_MODE |
206d7550bf45
add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
21 else |
206d7550bf45
add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
22 xrandr --output $INTERNAL --off --output $EXTERNAL --mode $EXTERNAL_MODE |
206d7550bf45
add a program for swapping screens
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
23 fi |