--- /dev/null
+#! /bin/sh
+logger "AC event..."
+
--- /dev/null
+#! /bin/sh
--- /dev/null
+#!/bin/sh
+
+/etc/init.d/autofs restart
+
+
--- /dev/null
+#!/bin/sh
+pm-hibernate
+
--- /dev/null
+#!/bin/sh
+logger "Locking screen..."
+
+LOG=/var/log/btn-lock.log
+date >> $LOG
+
+/usr/local/bin/lockkde.sh
+echo "Locked..." >> $LOG
+
+. /usr/local/bin/getXenv.inc
+
+#Thinkpad acceleration alert
+su $user -c /usr/local/bin/tp_alert.sh >> $LOG 2>&1
+
+
+
--- /dev/null
+#!/bin/sh
+
+#PM_DEBUG=true pm-suspend
+pm-suspend
+
--- /dev/null
+#!/bin/sh
+
+. /usr/local/bin/getXenv.inc
+
+if (synclient -l | grep TouchpadOff | grep -q 0) ; then
+ echo "touchpad on, turning it off"
+ su $user -c "synclient TouchpadOff=1"
+else
+ echo "touchpad off, turning it on"
+ su $user -c "synclient TouchpadOff=0"
+fi
+
+
--- /dev/null
+#! /bin/sh
+
+. /usr/local/bin/getXenv.inc
+
+STATEFILE="/var/run/vgastate"
+LVDS1_defaultmode="1366x768"
+
+function vgaoff
+{
+ logger "Turn external video off, putting LVDS1 to standard setup"
+ xrandr --output VGA1 --off \
+ --output HDMI2 --off \
+ --output LVDS1 --primary --mode $LVDS1_defaultmode --scale 1x1
+ echo "vgaoff" > $STATEFILE
+}
+
+function vgamirror
+{
+ logger "Mirror LVDS1 to $1"
+ xrandr --output $1 --primary --auto \
+ --output LVDS1 --mode 1024x768 --same-as VGA1
+ echo "vgamirror" > $STATEFILE
+}
+
+function vgarightof
+{
+ logger "Putting $1 right of of LVDS1"
+ xrandr --output LVDS1 --primary --auto --mode $LVDS1_defaultmode \
+ --output $1 --auto --right-of LVDS1
+ echo "vgarightof" > $STATEFILE
+}
+
+function vgaleftof
+{
+ logger "Putting $1 left of of LVDS1"
+ xrandr --output LVDS1 --primary --auto --mode $LVDS1_defaultmode \
+ --output $1 --auto --left-of LVDS1
+ echo "vgaleftof" > $STATEFILE
+}
+
+
+extconn=""
+xrandr | grep "VGA1 connected" && extconn="VGA1"
+xrandr | grep "HDMI2 connected" && extconn="HDMI2"
+
+if [ -n "$extconn" ]; then
+ case `cat $STATEFILE 2> /dev/null` in
+
+ vgarightof)
+ vgaleftof $extconn
+ exit 0
+ ;;
+
+ vgaleftof)
+ vgamirror $extconn
+ exit 0
+ ;;
+
+
+ vgamirror)
+ vgaoff
+ exit 0
+ ;;
+
+ *)
+ vgarightof $extconn
+ exit 0
+ ;;
+ esac
+else
+ vgaoff
+fi
--- /dev/null
+#! /bin/bash
+. /usr/local/bin/getXenv.inc
+
+logger "Disabeling VGA"
+xrandr --output VGA1 --off
+echo "off" > /var/run/vgastate
+
+
+
--- /dev/null
+#! /bin/sh
+
--- /dev/null
+#! /bin/sh
+
+test -f /usr/sbin/laptop_mode || exit 0
+
+# ac on/offline event handler
+
+/usr/sbin/laptop_mode auto
--- /dev/null
+#! /bin/sh
+
+test -f /usr/sbin/laptop_mode || exit 0
+
+# Automatically disable laptop mode when the battery almost runs out,
+# and re-enable it when it
+
+/usr/sbin/laptop_mode auto
--- /dev/null
+#! /bin/sh
+
+test -f /usr/sbin/laptop_mode || exit 0
+
+# lid button pressed/released event handler
+
+/usr/sbin/laptop_mode auto
--- /dev/null
+#!/bin/sh
+# /etc/acpi/powerbtn.sh
+# Taken from Debian's 2.0.4-1 diff file. This version handles KDE4.
+# Power Button event handler.
+# Checks to see if gnome or KDE are already handling the power button.
+# If not, initiates a plain shutdown.
+
+# getXuser gets the X user belonging to the display in $displaynum.
+# If you want the foreground X user, use getXconsole!
+# Input:
+# displaynum - X display number
+# Output:
+# XUSER - the name of the user
+# XAUTHORITY - full pathname of the user's .Xauthority file
+getXuser() {
+ user=`pinky -fw | awk '{ if ($2 == ":'$displaynum'" || $(NF) == ":'$displaynum'" ) { print $1; exit; } }'`
+ if [ x"$user" = x"" ]; then
+ startx=`pgrep -n startx`
+ if [ x"$startx" != x"" ]; then
+ user=`ps -o user --no-headers $startx`
+ fi
+ fi
+ if [ x"$user" != x"" ]; then
+ userhome=`getent passwd $user | cut -d: -f6`
+ export XAUTHORITY=$userhome/.Xauthority
+ else
+ export XAUTHORITY=""
+ fi
+ export XUSER=$user
+}
+
+# Gets the X display number for the active virtual terminal.
+# Output:
+# DISPLAY - the X display number
+# See getXuser()'s output.
+getXconsole() {
+ console=`fgconsole`;
+ displaynum=`ps t tty$console | sed -n -re 's,.*/X .*:([0-9]+).*,\1,p'`
+ if [ x"$displaynum" != x"" ]; then
+ export DISPLAY=":$displaynum"
+ getXuser
+ fi
+}
+
+# Skip if we are just in the middle of resuming.
+test -f /var/lock/acpisleep && exit 0
+
+# If the current X console user is running a power management daemon that
+# handles suspend/resume requests, let them handle policy.
+
+getXconsole
+
+# A list of power management system process names.
+PMS="gnome-power-manager kpowersave xfce4-power-manager"
+PMS="$PMS guidance-power-manager.py dalston-power-applet"
+
+# If one of those is running or any of several others,
+if pidof x $PMS > /dev/null ||
+ ( test "$XUSER" != "" && pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop --user $XUSER kded kded loadedModules | grep -q klaptopdaemon) ||
+ ( test "$XUSER" != "" && test -x /usr/bin/qdbus && test -r /proc/$(pidof kded4)/environ && su - $XUSER -c "eval $(echo -n 'export '; cat /proc/$(pidof kded4)/environ |tr '\0' '\n'|grep DBUS_SESSION_BUS_ADDRESS); qdbus org.kde.kded" | grep -q powerdevil) ; then
+ # Get out as the power manager that is running will take care of things.
+ exit
+fi
+
+# No power managment system appears to be running. Just initiate a plain
+# shutdown.
+/sbin/shutdown -h now "Power button pressed"
+
--- /dev/null
+#!/bin/sh
+# /etc/acpi/default.sh
+# Default acpi script that takes an entry for all actions
+
+set $*
+
+group=${1%%/*}
+action=${1#*/}
+device=$2
+id=$3
+value=$4
+
+log_unhandled() {
+ logger "ACPI event unhandled: $*"
+}
+
+case "$group" in
+ button)
+ case "$action" in
+ power)
+ /etc/acpi/actions/powerbtn.sh
+ ;;
+
+ # if your laptop doesnt turn on/off the display via hardware
+ # switch and instead just generates an acpi event, you can force
+ # X to turn off the display via dpms. note you will have to run
+ # 'xhost +local:0' so root can access the X DISPLAY.
+ #lid)
+ # xset dpms force off
+ # ;;
+
+ *) log_unhandled $* ;;
+ esac
+ ;;
+
+ ac_adapter)
+ case "$value" in
+ # Add code here to handle when the system is unplugged
+ # (maybe change cpu scaling to powersave mode). For
+ # multicore systems, make sure you set powersave mode
+ # for each core!
+ #*0)
+ # cpufreq-set -g powersave
+ # ;;
+
+ # Add code here to handle when the system is plugged in
+ # (maybe change cpu scaling to performance mode). For
+ # multicore systems, make sure you set performance mode
+ # for each core!
+ #*1)
+ # cpufreq-set -g performance
+ # ;;
+
+ *) log_unhandled $* ;;
+ esac
+ ;;
+
+ *) log_unhandled $* ;;
+esac
--- /dev/null
+#event=ibm/hotkey HKEY 00000080 00006030
+#action=/etc/acpi/actions/ac.sh
+
--- /dev/null
+event=ibm/hotkey HKEY 00000080 0000100c
+action=/etc/acpi/actions/btn-hibernate.sh
+
--- /dev/null
+event=ibm/hotkey HKEY 00000080 00001002
+action=/etc/acpi/actions/btn-lock.sh
+
--- /dev/null
+event=ibm/hotkey HKEY 00000080 00001003
+action=/etc/acpi/actions/btn-battery.sh
+
--- /dev/null
+event=ibm/hotkey HKEY 00000080 00001004
+action=/etc/acpi/actions/btn-suspend.sh %e
+
--- /dev/null
+event=ibm/hotkey HKEY 00000080 00001005
+action=/etc/acpi/actions/btn-wireless.sh
+
--- /dev/null
+event=ibm/hotkey HKEY 00000080 00001006
+action=/etc/acpi/actions/btn-cammic.sh
+
--- /dev/null
+event=ibm/hotkey HKEY 00000080 00001007
+action=/etc/acpi/actions/btn-vga.sh
+
--- /dev/null
+event=ibm/hotkey HKEY 00000080 00001008
+action=/etc/acpi/actions/btn-touchpad.sh
+
--- /dev/null
+event=ibm/hotkey HKEY 00000080 00001009
+action=/etc/acpi/actions/btn-vgapause.sh
+
--- /dev/null
+# /etc/acpi/events/default
+# This is the ACPID default configuration, it takes all
+# events and passes them to /etc/acpi/default.sh for further
+# processing.
+
+# event keeps a regular expression matching the event. To get
+# power events only, just use something like "event=button[ /]power.*"
+# to catch it.
+# action keeps the command to be executed after an event occurs
+# In case of the power event above, your entry may look this way:
+#event=button[ /]power.*
+#action=/sbin/init 0
+
+# Optionally you can specify the placeholder %e. It will pass
+# through the whole kernel event message to the program you've
+# specified.
+
+event=.*
+action=/etc/acpi/default.sh %e
--- /dev/null
+event=ac_adapter.*
+action=/etc/acpi/actions/lm_ac_adapter.sh
--- /dev/null
+event=battery.*
+action=/etc/acpi/actions/lm_battery.sh %e
--- /dev/null
+event=button[ /]lid
+action=/etc/acpi/actions/lm_lid.sh %e