-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
udev rule executed too early? #61
Comments
Seems like it is. Maybe it suffices to run udev kills external processes after some time, so we cannot sleep for long times. Using systemd might be an option: We can generate a device unit using an udev rule that "wants" the autorandr service unit to run. Of course, we'd have to change the unit file to (I have never used that feature before, so I'd have to look into this as well.) |
…t the current config See bug #61
Here's a simple workaround: In the predetect branch, I've added support for a new script hook, Is this a viable solution for the problems you're experiencing? |
Regarding my earlier suggestion: I just attempted to do it that way. That doesn't work: At least with my Intel card, I only receive CHANGE events in udev, not additions and removal of devices. At the first change after installing the udev rule, systemd creates a device unit, but for every later change, it just does nothing. 😞 But we could combine both ideas. See the systemd-change branch: I now invoke the systemd unit from the udev rule. This way, the timeout from udev does not apply and you can safely use a |
…t the current config See bug #61
Hi. On NixOS distro, having an udev rule which invokes autorandr systemd unit breaks systemd-udev-settle service at computer boot. Do you have an idea why it may happen? Thanks. |
Breaks in which sense? Does it hang? Does it help to edit the udev rule to execute
instead of running autorandr directly? ( |
@phillipberndt At the computer boot at some stage a message Thank you! Your rule helps, though only after changing Failure log:
Success boot after switching to your rule (slighly modified as I wrote earlier):
Auto-switching outputs on monitor hotplug works. |
The problem with that is that If we can find a way to reliably detect whether this fix is required, I'll add the necessary changes to the Makefile, otherwise, I'd prefer if you'd fix this downstream :-) |
@phillipberndt
which exists only in this distro. I will make a downstream fix. Thank you much for your knowledge and help! :) |
@phillipberndt Hi again! NixOS people suggested the following universal udev rule |
I expected this rule to lead to autorandr being executed only once, instead
of each time a screen is attached/removed. Have you tested that this does
indeed still work? If it does, then this would be a great alternative, sure.
|
@phillipberndt Did a better testing and yes, you're right. Sorry then :-) |
FYI, the suggestions by @Mic92 sound good to me. If they work as expected please let me know, I'll include them upstream. |
I didn't get this. Don't we all use different devices? As for second suggestion |
You can refer to the instance name using "%i", e.g., have a look at "ifup@.service". (This would probably be a neater solution, I'm fine with the |
¯_(ツ)_/¯ No success with that. At first
|
Let's stick with the |
@phillipberndt Yes, please add :-) Since it's a tiny change I'll only slowdown the process. Thank you! |
Alright. Added & published as autorandr 1.1. Thanks for your help! |
@phillipberndt Great, thank you much! :) |
It could be still possible to also encode device dependencies into the service by using:
But the current solution might be good enough for the moment. |
After getting the udev rule to work, I am sometimes running into trouble, where disconnecting an external monitor changes the profile to external monitor, and connecting an external monitor changes the profile to only my laptop. So it's doing the opposite of what it should).
My guess is that
autorandr
is run too "early", such that the output ofxrandr
does not reflect the actual state of things.If I have time one of the next days, I'll try to look into it.
The text was updated successfully, but these errors were encountered: