Closed kylechui closed 1 year ago
I use autorandr
regularly and have no problem with it.
Although I have xrandr
in my PATH, I have not enabled it through home-manager.
What are you referring to by programs.xrandr.enable
? I don't see such option in neither home-manager nor NixOS...
Despite all that, if running the autorandr command by hand fails as well, then the problem does not come from the home-manager autorandr module I guess. Have you try to re-create an autorandr profile from scratch and apply it ?
Sorry for the typo, I meant I have both services.autorandr.enable = true
and programs.autorandr.enable = true
. I also have xrandr
on my PATH. Running the command autorandr mobile
without unplugging my monitor works just fine, and then if I do autorandr docked
right after that switches it back to my monitor. The issue is that when I unplug my monitor from my laptop (FWIW I am using a USB-C hub for this), the profile does change to mobile
, but the display for my laptop stays off. Similarly, when I replug my monitor, both displays remain off (even though the profile changes back to docked
).
I then have to do something like autorandr --change
to force it to "update" and match the profile. Hopefully I am making things more clear, sorry for the confusion.
Here is my current configuration if that helps: dotfiles link
Well, setting services.autorandr.enable = true
will automate the launch of autorandr
only when you log in to your session.
The HM module is not setting other automation that run autorandr
automatically when you plug/unplug a monitor.
It is then normal to have to run autorandr --change
explicitly when you need to.
Now, if autorandr --change
fails, that is another story.
Then, you have to check if the equivalent xrandr
command fails as well.
Sorry if I don't understand your question ^^
Ah I see, I think I completely misunderstood the purpose of autorandr
; it just allows you to detect the current state of what displays are connected, not actually change the active displays (which needs to be done manually). Sorry for the noise!
Ah I see, I think I completely misunderstood the purpose of
autorandr
; it just allows you to detect the current state of what displays are connected, not actually change the active displays (which needs to be done manually). Sorry for the noise!
Indeed. It detects which profile to apply and apply it (when invoked with --change
) when you run it.
Basically, autorandr
is nothing more than a script, so you have to explicitly call it for it to do anything.
Having said that, you can add a layer of automation to make it run "automatically". That was the idea of the services.autorandr
home-manager module.
The limitation was the lack of a systemd hook that gets triggered when you (un)plug a screen. Hence, the only automation that we were able to achieve is that autorandr
is run when you log in into your session.
Relevant discussion: https://github.com/nix-community/home-manager/pull/3623#discussion_r1088394080
Are you following the right branch?
Is there an existing issue for this?
Issue description
I'm using both
programs.autorandr.enable
andprograms.xrandr.enable
. When I plug in my monitor, nothing happens. I did a bit of investigating by checking the output ofautorandr docked
, and got:Retrying the command yields the same result, and it seems that I have to "refresh" something by running
xrandr --auto
before I am able to useautorandr --change
. I imagine that if the error didn't happen, then I wouldn't even need to runautorandr
commands manually and that things would "just work". Additionally, the same error occurs if I unplug my monitor:autorandr mobile
yields a similar errorPlease let me know if I'm missing any details!
Maintainer CC
@GaetanLepage @uvNikita
System information