summaryrefslogtreecommitdiff
path: root/extra/powerbtn.sh
blob: 42322aedc75b8fd75e598a6c96adbf1e24bdb82a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
# /etc/acpi/powerbtn.sh
# Initiates a shutdown when the power putton has been
# pressed.

# If vdr is running, let it process the shutdown
if pidof vdr; then
   svdrpsend.pl HITK Power
   exit 0
fi

# If powersaved is running, let it process the acpi event
if pidof powersaved; then
    exit 0
fi

if ps -Af | grep -q '[k]desktop' && test -f /usr/bin/dcop
then
    dcop --all-sessions --all-users ksmserver ksmserver logout 0 2 0 && exit 0
else
    /sbin/shutdown -h now "Power button pressed"
fi
acpi event