The normal logout function can also be reached through dcop:
code:
1:
dcop ksmserver ksmserver logout confirm sdtype sdmode
, where confirm, sdtype and sdmode are numbers.
This parameters means the following:
confirm:
* -1: ShutdownConfirmDefault
* 0: ShutdownConfirmNo
* 1: ShutdownConfirmYes
sdtype:
* -1: ShutdownTypeDefault
* 0: ShutdownTypeNone
* 1: ShutdownTypeReboot
* 2: ShutdownTypeHalt
sdmode:
* -1: ShutdownModeDefault
* 0: ShutdownModeSchedule
* 1: ShutdownModeTryNow
* 2: ShutdownModeForceNow
* 3: ShutdownModeInteractive
I putted this command in the file /etc/acpi/acpi_handler.sh when the power button event occurs:
dcop ksmserver ksmserver -1 -1 -1
But it don't work with this error:
ERROR: Couldn't attach to DCOP server!
this is the file:
#!/bin/sh
# Default acpi script that takes an entry for all actions
# /sbin/init 0
IFS=${IFS}/
set $@
case "$1" in
button)
case "$2" in
power) /opt/kde/bin/dcop ksmserver ksmserver -1 -1 -1
;;
*) logger "ACPI action $2 is not defined"
;;
esac
;;
*)
logger "ACPI group $1 / action $2 is not defined"
;;
esac
Why???