hotkey_button revision 1.1
11.1Sjmcneill#!/bin/sh -
21.1Sjmcneill#
31.1Sjmcneill#	$NetBSD: hotkey_button,v 1.1 2007/12/22 19:04:11 jmcneill Exp $
41.1Sjmcneill#
51.1Sjmcneill# Generic script for hotkey events. 
61.1Sjmcneill#
71.1Sjmcneill# Arguments passed by powerd(8):
81.1Sjmcneill#
91.1Sjmcneill#	hotkey event
101.1Sjmcneill
111.1SjmcneillPATH=/usr/pkg/bin:$PATH; export PATH
121.1Sjmcneill
131.1Sjmcneill# XXXJDM need a better way to determine this
141.1SjmcneillXUSER="$(ls -l /dev/console | awk '{ print $3; }')"
151.1SjmcneillDISPLAY=:0.0; export DISPLAY
161.1Sjmcneill
171.1Sjmcneillcase "${2}" in
181.1Sjmcneillpressed)
191.1Sjmcneill	if [ -f "/etc/powerd/actions/${1}" ]; then
201.1Sjmcneill		sudo -u "$XUSER" -i "/etc/powerd/actions/${1}"
211.1Sjmcneill	fi
221.1Sjmcneill	exit 0
231.1Sjmcneill	;;
241.1Sjmcneillreleased)
251.1Sjmcneill	;;
261.1Sjmcneill*)
271.1Sjmcneill	logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
281.1Sjmcneill	exit 1
291.1Sjmcneillesac
30