Skip to content

Instantly share code, notes, and snippets.

@ursm
Created March 29, 2009 13:41
Show Gist options
  • Select an option

  • Save ursm/87398 to your computer and use it in GitHub Desktop.

Select an option

Save ursm/87398 to your computer and use it in GitHub Desktop.
#!/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)
/sbin/init 0
;;
lid)
lid_uid=$(hal-find-by-property --key button.type --string lid)
lid_closed=$(hal-get-property --key button.state.value --udi ${lid_uid})
case "$lid_closed" in
true)
/usr/sbin/pm-suspend
;;
false)
logger "lid open."
;;
*) log_unhandled $* ;;
esac
;;
*) log_unhandled $* ;;
esac
;;
ac_adapter)
case "$value" in
*0)
xbacklight -display ":0.0" -set 50
;;
*1)
xbacklight -display ":0.0" -set 100
;;
*) log_unhandled $* ;;
esac
;;
*) log_unhandled $* ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment