2 #This script is run when Display toggle button (Fn-F5) is pressed.
4 OUTPUT_DISPLAY_MODE
="clone"
6 source /etc
/acpi
/eee.conf
8 if [ -S /tmp
/.X11-unix
/X0
]; then
10 user
=$
(who |
grep "vc/7" |
awk '{ if ($(NF) == "(:0)") print $1 }')
13 logger
"Could not verify user for X:"
15 logger
"Falling back to XUSER: $XUSER"
18 logger
"Found X session user: $user"
20 XAUTHORITY
=/home
/$user/.Xauthority
21 [ -f $XAUTHORITY ] && export XAUTHORITY
23 logger
"X not probably running, lets launch the command anyway"
28 # if we are being called directly from an ACPI script, do a little hack
29 if [ "$action" = "hotkey" ]; then
31 00000030) action
="lvds" ;;
32 00000031) action
="vga" ;;
33 00000032) action
="both" ;;
34 *) echo "unknown hotkey $3!"; exit 1 ;;
40 xrandr
--output LVDS
--preferred --output VGA
--off
43 if [ "$OUTPUT_DISPLAY_MODE" == "clone" ]; then
44 xrandr
--output LVDS
--preferred --output VGA
--preferred
46 xrandr
--output LVDS
--mode 800x480
--output VGA
--"$OUTPUT_DISPLAY_MODE" LVDS
50 xrandr
--output LVDS
--off --output VGA
--preferred
53 echo "Usage: $0 [lvds|both|vga]";