updated on Tue Jan 17 12:00:36 UTC 2012
[aur-mirror.git] / acpi-eeepc-generic-svn / acpi-eeepc-generic-rotate-lvds.sh
blob3a4fcfc8d817808ee53f240c7c57752309b14ad7
1 #!/bin/bash
3 # LVDS Rotate
4 # Andrew Wyatt
5 # Tool to rotate LVDS panel
8 source /etc/conf.d/acpi-eeepc-generic.conf
9 source /etc/acpi/eeepc/acpi-eeepc-generic-functions.sh
11 [ ! -d "$EEEPC_VAR" ] && mkdir $EEEPC_VAR
13 function rotate_toggle {
14 CURRENT=`xrandr | grep LVDS | awk '{print $4}'`
15 if [ "$CURRENT" = "left" ]; then
16 ROTATION="inverted"
17 elif [ "$CURRENT" = "inverted" ]; then
18 ROTATION="right"
19 elif [ "$CURRENT" = "right" ]; then
20 ROTATION="normal"
21 else
22 ROTATION="left"
24 if [ "$ROTATION" ]; then
25 rotate_lvds "$ROTATION"
26 echo "$ROTATION" > $EEEPC_VAR/rotation_saved
30 function restore_rotation {
31 if [ -e "$EEEPC_VAR/rotation_saved" ]; then
32 ROTATION=$(cat $EEEPC_VAR/rotation_saved)
33 rotate_lvds "$ROTATION"
37 function rotate_lvds {
38 eeepc_notify "Rotate LCD \"$1\"" screen
39 xrandr --output LVDS --rotate "$1"
42 case $1 in
43 inverted)
44 rotate_lvds inverted
46 left)
47 rotate_lvds left
49 right)
50 rotate_lvds right
52 normal)
53 rotate_lvds normal
55 restore)
56 restore_rotation
59 rotate_toggle
61 esac