2007-12-22 22:04:10 +03:00
|
|
|
#!/bin/sh -
|
|
|
|
#
|
2008-01-17 03:37:46 +03:00
|
|
|
# $NetBSD: hotkey_button,v 1.2 2008/01/17 00:37:46 christos Exp $
|
2007-12-22 22:04:10 +03:00
|
|
|
#
|
|
|
|
# Generic script for hotkey events.
|
|
|
|
#
|
|
|
|
# Arguments passed by powerd(8):
|
|
|
|
#
|
|
|
|
# hotkey event
|
|
|
|
|
|
|
|
PATH=/usr/pkg/bin:$PATH; export PATH
|
|
|
|
|
|
|
|
# XXXJDM need a better way to determine this
|
|
|
|
XUSER="$(ls -l /dev/console | awk '{ print $3; }')"
|
|
|
|
DISPLAY=:0.0; export DISPLAY
|
|
|
|
|
|
|
|
case "${2}" in
|
|
|
|
pressed)
|
|
|
|
if [ -f "/etc/powerd/actions/${1}" ]; then
|
2008-01-17 03:37:46 +03:00
|
|
|
/usr/bin/su -- "$XUSER" -c "/etc/powerd/actions/${1}"
|
2007-12-22 22:04:10 +03:00
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
released)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
|
|
|
|
exit 1
|
|
|
|
esac
|