1 1.2.2.2 christos #!/bin/sh - 2 1.2.2.2 christos # 3 1.2.2.2 christos # $NetBSD: hotkey_button,v 1.2.2.2 2008/01/17 00:37:47 christos Exp $ 4 1.2.2.2 christos # 5 1.2.2.2 christos # Generic script for hotkey events. 6 1.2.2.2 christos # 7 1.2.2.2 christos # Arguments passed by powerd(8): 8 1.2.2.2 christos # 9 1.2.2.2 christos # hotkey event 10 1.2.2.2 christos 11 1.2.2.2 christos PATH=/usr/pkg/bin:$PATH; export PATH 12 1.2.2.2 christos 13 1.2.2.2 christos # XXXJDM need a better way to determine this 14 1.2.2.2 christos XUSER="$(ls -l /dev/console | awk '{ print $3; }')" 15 1.2.2.2 christos DISPLAY=:0.0; export DISPLAY 16 1.2.2.2 christos 17 1.2.2.2 christos case "${2}" in 18 1.2.2.2 christos pressed) 19 1.2.2.2 christos if [ -f "/etc/powerd/actions/${1}" ]; then 20 1.2.2.2 christos /usr/bin/su -- "$XUSER" -c "/etc/powerd/actions/${1}" 21 1.2.2.2 christos fi 22 1.2.2.2 christos exit 0 23 1.2.2.2 christos ;; 24 1.2.2.2 christos released) 25 1.2.2.2 christos ;; 26 1.2.2.2 christos *) 27 1.2.2.2 christos logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1 28 1.2.2.2 christos exit 1 29 1.2.2.2 christos esac 30