#!/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) case $(cat /proc/acpi/button/lid/LID0/state | awk '{print $2}') in closed) XAUTHORITY=/home/joecool/.Xauthority xset -display :0 dpms force off ;; open) XAUTHORITY=/home/joecool/.Xauthority xset -display :0 dpms force on ;; esac ;; *) 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 -c 0 -g powersave cpufreq-set -c 1 -g powersave cpufreq-set -c 2 -g powersave cpufreq-set -c 3 -g powersave echo 50 > /sys/class/backlight/intel_backlight/brightness #echo 2 > /sys/class/backlight/acpi_video0/brightness ;; # 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 -c 0 -g performance cpufreq-set -c 1 -g performance cpufreq-set -c 2 -g performance cpufreq-set -c 3 -g performance echo 300 > /sys/class/backlight/intel_backlight/brightness #echo 10 > /sys/class/backlight/acpi_video0/brightness ;; *) log_unhandled $* ;; esac ;; *) log_unhandled $* ;; esac