I've made a tkinter app to handle the power button press, but it doesn't launch when it should. Although if I use echo hello>>~/junk as the acpi action, it adds a hello to junk for every power button press. Adding an exec or a dot before the action command (to execute it in the current shell) didn't help. How can I make it work?
Edit:
Ok I got that to work with the help of mikejonesey, but one more issue appeared after that. The script is called with root privilages, even with the suid bit set on the script, so I have to enter the root passwd at the xlock screen to resume.
Edit 2:
It looks like I can launch the app from an acpi events file like this one:
event=button/power PBTN
action=export DISPLAY=:0 && export XAUTHORITY=/home/saga/.Xauthority &&/home/saga/bin/shutdownprompt
but not from a handler script called from an event file:
button/power )
if [ "$2" = "PBTN" ];then
export DISPLAY=:0 && export XAUTHORITY=/home/saga/.Xauthority && /home/saga/shutdownprompt;
fi
;;
This is a clipping from main handler script called on every key press. What is the problem here?