Use wlr-randr from a second user

147 Views Asked by At

I'm trying to automate turning my display on and off from the console as a second user (homebridge) on my system. I've been using wlr-randr (more specifically wlr-randr --output HDMI-A-1 --on/off) to toggle the display, which works fine from the main user (pi). However, when I run this command from a second user (homebridge), i get the following error messages:

error: XDG_RUNTIME_DIR is invalid or not set in the environment.
failed to connect to display

It seems the second user isn't created with the correct environment variables set, and there is no ~/.Xauthority file generated. I've also tried using xrandr (which outputs correct information for tha main user, but which I haven't been able to use to actually change output configuration), but get a similar error message:

Can't open display

Is this an issue with permissions? How should I go about solving this?

0

There are 0 best solutions below