phillipberndt / autorandr

Auto-detect the connected display hardware and load the appropriate X11 setup using xrandr
2.48k stars 123 forks source link

Enabling udev rule / systemd service on a per-user basis? #385

Closed rlue closed 4 months ago

rlue commented 4 months ago

I have a system with two users. One of them uses i3 with autorandr; the other uses KDE and relies (or would like to rely) solely on its display configuration mechanism. The user on KDE is experiencing a problem when connecting a display where the screen flashes on and off multiple times before settling on a final resolution; it appears that autorandr and KDE are trying to set the display configuration at the same time, leading to a race condition.

I would like to know if it is possible to disable autorandr (or, more precisely, prevent it from running automatically when connecting a display) on a per-user basis.

I don't suppose it is possible to apply a filter for udev rules based on which user the current X session belongs to, or to cancel the execution of autorandr from the systemd service , is there?

phillipberndt commented 4 months ago

The best idea I can come up with is to not use udev/systemd. Use the x11 daemon solution instead.

Alternatively, create a predetect hook for the user you don't want to use the tool with and use it to kill it.

rlue commented 4 months ago

Ah I see, that makes a lot of sense. Would be nice to have some documentation on the udev-vs.-x11-daemon options, but not sure where the best place for those would be. (README? Wiki? Manpage?) I'm happy to leave well enough alone, but maybe if I am feeling particularly inspired, I'll take a stab at a doc contribution one of these days.

I might ask, as a follow-up, if there is a recommended way to disable the udev rule once it's been installed via, e.g., a .deb package; I just moved 40-monitor-hotplug.rules to 40-monitor-hotplug.rules.bak, but I suspect that would be overwritten when upgrading. Thanks again for an absolutely indispensable utility 🙏🙏🙏