Hi all
I am trying to run xset dpms force off when a keyboard button is pressed. The button generates video/switchmode ACPI event, and I have put the following code in /etc/acpi/default to trigger the command:
Code:
case "$group" in
video)
case "$action" in
switchmode)
DISPLAY=:0 xset dpms force off ;;
*) log_unhandled $* ;;
esac
;;
*) log_unhandled $* ;;
esac
Here is what I know:
(i) The match works fine, for when I run `/etc/acpi/default.sh "video/switchmode"', my monitor switches off.
(ii) Acpid is working fine too, for if I replace
Code:
DISPLAY=:0 xset dpms force off ;;
with
Code:
touch /home/niku/test ;;
and restart acpid and then press the button, the file ~/test gets updated.
(iii) I tried prefixing `DISPLAY=:0' after the suggestion
here but it didn't work!
(iv) Acpid runs as root. The command in (i) switches off the monitor both as normal user and root.
(v) Providing full path of xset (/usr/bin/xset) in the script doesn't help either.
What else should I try? The above link mentions checking other environment variables too, but I couldn't find any information about it xset's or acpid's manpage.
Edit: It is clearly a problem with getting xset to work. In the log files, in (ii), when using touch command, the script exits with 0. When using xset, the script exits with 1. I read somewhere (forgotten where), that 1 means that there is some "minor error".
Thanks!