You are not logged in.
Hi, I have the following problem: I want set an action, when power button is pushed, different from shutdown and I want do this with a rule in acpid. Before set a rule in acpid, I modified the /etc/systemd/logind.conf in the following way:
...
HandlePowerKey=ignore
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore
...Of course I restart systemd-logind service.
After this, I run #acpi_listen and when I press the power button, the output is the following:
button/power PBTN 00000080 00000000
button/power LNXPWRBN:00 00000080 00000008So at this point, with reference to arch wiki, I tried to set the acpid rule with a modify the /etc/acpi/handler.sh in this way:
#!/bin/bash
# Default acpi script that takes an entry for all actions
case "$1" in
button/power)
case "$2" in
PBTN)
notify-send "this is a test message"
;;
*)
logger 'Power button pressed'
;;
esac
;;
...
esacBecause with this setting doesn't happens nothing, I tried the alternative configuration suggested in the arch wiki, So I create a file in /etc/acpi/events/power with this content:
event=button/power
action=/etc/acpi/actions/power.sh "%e"where power.sh has this content:
#!/bin/bash
notify-send "this is a test message"but also in the way when I push the power button doesn't happens nothing. Can you help me?
P.S. I try to restart both service systemd-logind and acpid but the result is the same
Last edited by pepib (2015-03-09 12:07:27)
Offline
notify-send requires that the DISPLAY variable is set, as well as an installed notification daemon (like dunst). Test acpid in another way (e.g through logger and journalctl), or see the getuser function on the wiki page.
Last edited by Alad (2015-03-07 10:29:08)
Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby
Offline
Edit: This smells like a xyproblem
Last edited by Mr.Elendig (2015-03-07 12:03:15)
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
In the handler.sh script I put the getuser function and I modified the handler.sh as following:
...
case "$1" in
button/power)
case "$2" in
PBTN)
getuser notify-send "this is a test message"
...but it continued to doesn't working. So at this point at place of getuser function I tried to put the
export XAUTHORITY="/home/user/.Xauthority"
export DISPLAY=":0.0"but it doesn't working. Fortunately, at the end I find this possible solution http://goo.gl/Lq4TsY that use uacpid. What was the problem? Where I wrong?
Offline
in addition to xuserrun suggested in the arch wiki reports this error:
xuserrun: no X.org server detected runningP.S. my current WM is openbox that it's start in .xinitr with this command : exec openbox
Offline
So you're now spending a lot of time on getting a test message working? Or is sending a notification your end goal? (See Mr.Elendig's reply.)
PS: you can use the "Edit" link to add something to your last post.
Offline
It's only a test because for example I want set a dialog window (with option reboot,suspend, lock, shutdown) when I press the power button and I want avoid the instantaneous shutdown. I know that I can set the button in the WM but my idea is that the button shortcut is persistent across the different DE (fluxbox, openbox, i3wm, bspwm and so on).
Offline
Use shxkd or xbindkeys.
Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby
Offline
thanks, man! I haven't thinked at this simple solution. I'm feel so stupid.
Offline