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
display-manager: allow executable background #49492
Conversation
If ~/.background-image is executable, run it to set background image. Useful when using something like Nitrogen
@@ -73,7 +73,9 @@ in | |||
manage = "desktop"; | |||
start = d.start | |||
+ optionalString (needBGCond d) '' | |||
if [ -e $HOME/.background-image ]; then | |||
if [ -x $HOME/.background-image ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will execute JPGs copied from a FAT filesystems, which often have the executable bit set in VFS due to permissive mount options. You could check for a #!
or ELF magic bytes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would much rather remove the entire section and let people set their own colours and wallpapers than try to work around every possible edge case here.
Tbh, the default display manager script definitely doesn't look like the right place to me to put wallpaper logic, use your window manager or something instead. And I'd also rather use a different file for this (e.g. |
This was extremely confusing when I started using NixOS. I tried running This entire section seems very wrong to me, but this PR proposes one possible workaround. I'd much rather remove all wallpaper logic from here, honestly. But this won't break people's configs. |
Are there any updates on this pull request, please? |
Doesn't seem like there's an agreement of how this should actually be handled. |
Looking at this again, I think the best course of action is to implement a way to turn off this automatic background setting. I'm currently looking into how to implement this |
I just created #78346 which adds an option to prevent NixOS from messing with the background. Let me know if this works for you. |
Closing this because since #78346 that usecase is now supported with e.g. |
Getting the background color/image correctly configured has been a bit tricky due to the interactions of the display manager, compton, and NixOS. NixOS is doing the following. If ~/.background-image exists, it uses feh to set that as the background, otherwise, it uses xsetroot to set the root X window's background to black: xsetroot -solid black This happens _after_ displayManager.sessionCommands have been run, clobbering any color that was previously set. A fix for this has been merged upstream: NixOS/nixpkgs#78346 Also relevant is a newly introduced option: services.xserver.windowManager.i3.extraSessionCommands NixOS/nixpkgs#49492 (comment) In the meantime, my workaround has been to create an image with the color I want and copy it to ~/.background-image. While trying to figure out how to get conky to work in i3, I learned that compton doesn't play nice with xsetroot. I haven't dug into too much detail, but it behaves as if compton introduces another layer of background that hides the layer xsetroot touches. Instead, using hsetroot has the desired affect.
Motivation for this change
I use Nitrogen to set my wallpaper.
Things done
If ~/.background-image is executable, run it to set background image. In my case, a bash script that runs
nitrogen --restore
.sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)