my old PC using acpi to catch special buttons' actions so I can execute some scripts for certain events. The problem - I can't start any graphical application with it. All graphical application reports that they can't find display. I tried to output user and tty which acpi using but there's no user and no tty, so as I a newbie in Linux I assumed acpi runs under some system hood.

PC is running under antiX linux so there's no DE only WM (with X11 server) and no systemd and systemctl. The question is how do I start graphical application in current X11 server session after acpi triggers a script?


Ok, I'm a little d*****s here was the answer. Basically you need to export display and authority rather inside acpi handler file or your script file like that:

export DISPLAY=:0.0
export XAUTHORITY=/home/<your name>/.Xauthority

Now if you will execute a graphical application command in acpi handler it will start, but it will be executed by root user. In order to execute script or command under your user you need to use sudo runuser -l <user name> -c <command to execute>, also if you want execute command under your user you need to insert exporting commands inside your script and not acpi handler file

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.