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