updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / acpi-eeepc-generic / acpi-eeepc-generic-rotate-lvds.sh
blob11e451ca040c33cfb0cb50013cb279d49e72cf26
1 #!/bin/bash
2 # Copyright 2009 Nicolas Bigaouette
3 # This file is part of acpi-eeepc-generic.
4 # http://code.google.com/p/acpi-eeepc-generic/
6 # acpi-eeepc-generic is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # acpi-eeepc-generic is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with acpi-eeepc-generic. If not, see <http://www.gnu.org/licenses/>.
19 # LVDS Rotate
20 # Andrew Wyatt
21 # Tool to rotate LVDS panel
24 . /etc/acpi/eeepc/acpi-eeepc-generic-functions.sh
26 var_xrandr="$EEEPC_VAR/xrandr.log"
27 xrandr > $var_xrandr
29 name_lvds=$(grep -i connected $var_xrandr | grep -i lvds | awk '{print ""$1""}')
31 function rotate_toggle {
32 CURRENT=`xrandr | grep LVDS | awk '{print $4}'`
33 if [ "$CURRENT" = "right" ]; then
34 ROTATION="inverted"
35 elif [ "$CURRENT" = "inverted" ]; then
36 ROTATION="left"
37 elif [ "$CURRENT" = "left" ]; then
38 ROTATION="normal"
39 else
40 ROTATION="right"
42 if [ "$ROTATION" ]; then
43 rotate_lvds "$ROTATION"
44 echo "$ROTATION" > $EEEPC_VAR/rotation_saved
48 function restore_rotation {
49 if [ -e "$EEEPC_VAR/rotation_saved" ]; then
50 ROTATION=$(cat $EEEPC_VAR/rotation_saved)
51 rotate_lvds "$ROTATION"
55 function rotate_lvds {
56 eeepc_notify "Rotate LCD \"$1\"" screen
57 xrandr --output ${name_lvds} --rotate "$1"
60 case $1 in
61 inverted)
62 rotate_lvds inverted
64 left)
65 rotate_lvds left
67 right)
68 rotate_lvds right
70 normal)
71 rotate_lvds normal
73 restore)
74 restore_rotation
77 rotate_toggle
79 esac