You are not logged in.

#1 2015-03-07 10:14:20

pepib
Member
Registered: 2014-07-13
Posts: 23

[SOLVED] Problem with acpid and systemd-logind

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 00000008

So 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
        ;;
...
esac

Because 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

#2 2015-03-07 10:16:53

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,420
Website

Re: [SOLVED] Problem with acpid and systemd-logind

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

#3 2015-03-07 12:01:37

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,097

Re: [SOLVED] Problem with acpid and systemd-logind

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

#4 2015-03-07 15:38:40

pepib
Member
Registered: 2014-07-13
Posts: 23

Re: [SOLVED] Problem with acpid and systemd-logind

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

#5 2015-03-07 15:45:38

pepib
Member
Registered: 2014-07-13
Posts: 23

Re: [SOLVED] Problem with acpid and systemd-logind

in addition to xuserrun suggested in the arch wiki reports this error:

xuserrun: no X.org server detected running

P.S. my current WM is openbox that it's start in .xinitr with this command : exec openbox

Offline

#6 2015-03-07 15:51:10

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [SOLVED] Problem with acpid and systemd-logind

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

#7 2015-03-07 16:03:51

pepib
Member
Registered: 2014-07-13
Posts: 23

Re: [SOLVED] Problem with acpid and systemd-logind

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

#8 2015-03-07 16:11:43

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,420
Website

Re: [SOLVED] Problem with acpid and systemd-logind

Use shxkd or xbindkeys.


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#9 2015-03-09 12:06:56

pepib
Member
Registered: 2014-07-13
Posts: 23

Re: [SOLVED] Problem with acpid and systemd-logind

thanks, man! I haven't thinked at this simple solution. I'm feel so stupid.

Offline

Board footer

Powered by FluxBB