treewide: wallpaper refactor
Checklist
- [x] Module support
- [x] Check function for types that actually restricts the type
- [x] Add documentation
- [ ] Add testing
Potential Additions
- Move more configuration into the custom types such as polarity
- Additional constructors for things such as generating a wallpapers like penrose tiling's and the like
- Add a utility function for documenting constructors
Reference
The following depend or should be improved based on this PR:
- https://github.com/danth/stylix/issues/131
- https://github.com/danth/stylix/issues/182
- https://github.com/danth/stylix/issues/207
- https://github.com/danth/stylix/issues/208
- https://github.com/danth/stylix/issues/251
- https://github.com/danth/stylix/issues/63
- https://github.com/danth/stylix/pull/135
- https://github.com/danth/stylix/pull/157
- https://github.com/danth/stylix/pull/175
running into this weird error when building docs error.txt
ready for review when you've got time.
@danth i think this is ready whenever you have time
We need to update the configuration page on the website to use the new constructors
do we want to run checks on that wallpaper types that ensures there contents are of the correct types?
That would be good if possible
I'm wondering if we should rename the option from wallpaper to something like theme or scheme, since it also contains the colour scheme and some other settings not related to the wallpaper.
yea i thought about that as well, ill differ to you on that one.
I found a small problem if you set a wallpaper on Wayland which is wider than the screen.
(I'm running Hyprland so it's not directly using your code, but I copied the wbg command into my config.)
It would look better if the image was cropped rather than squashed, which is what swww does by default.
We already use swww for slideshows and animations, so perhaps it would make sense to use it for static images too - then we also get a smooth transition if the config is changed.
swaybg also supports the crop if you run it with swaybg --image «path to image» --mode fill.
@danth do you mind if i add hyprland support to this pr as well? it would make to wlroots side of things easier for me to test
I feel like Hyprland might be better left for a separate pull request - this one is almost ready to merge.
Hi! Sorry for the radio silence, I just merged Hyprland support using the new Home Manager module if you were wanting to use that for the wallpapers
i went and looked on the kde side and cant find a way do set animations using nix, they appear to be available using plugins though, maybe we could place the image/animation/video in .config/stylix for desktops that we cant directly support?
also i went looking into adding the extra utility functions to lib, it appears to be possible, but difficult to implement, since we use them both as a user facing interface, as well as internally.
Although we can't add things to lib we should be able to make a separate stylix input so you can write stylix.function rather than config.lib.stylix.function. I was planning to commit that as soon as I have time to work on it, possibly later today
It looks like anywhere we use swww, if you set a slideshow wallpaper then change it to a different slideshow, the script will end up running twice until you restart. Could we find a way to fix this? Maybe moving it to a systemd user service would help.
i went and checked on the kde side of things, it appears that we would somehow have to install a plugin to use a non static wallpaper in kde, i dont have much experience with the kde nix inferstructure, so im not sure how, or if you even can, install kde plugins using nix.
In my experience with KDE on NixOS there's not much you can set up declaratively beyond basic settings. There might be a way to install the plugin by running commands from an activation script, user service or whatever, but that's not so reliable.
went ahead and put the wallpaper in etc/stylix and .config/stylix for unsupported modules
Some more things I want to try:
- Using the new type system for opacity, so you can write
config.stylix.opacity.desktop.as.floatand so on - Automatically generated documentation for black box types, essentially just a bunch of strings within the definition that get concatenated together in a certain way. This will give us a place to describe the different wallpaper variants in more detail, such as lising the supported image formats
- Moving
config.lib.stylixto a module argument so you can write{ stylix, ... }at the top of the file - Adding SVG and static color wallpapers
Some of these can wait until after merge.
What's the state of this PR (draft)?
I'd be willing to help by rewriting and deduplicating the functions in lib/utils.nix.
Is there something else I can/should work on?
@Sntx626 The main reason this isn't merged yet is because I'd like to remove the need to write out config.lib.stylix before every function, and just have it imported as { stylix, ... }. I tried to implement that a while back, but it led to infinite recursion.
The things you mentioned should help towards that.
It would also be useful to have more testing to make sure this doesn't break existing configs, or at least gives a helpful error message.
The main reason this isn't merged yet is because I'd like to remove the need to write out
config.lib.stylixbefore every function, and just have it imported as{ stylix, ... }. I tried to implement that a while back, but it led to infinite recursion.
Considering that several internal feature PRs are waiting for this PR to land, it might be better to refactor config.lib.stylix with { stylix, ... } at a later time in a followup PR.
It would also be useful to have more testing to make sure this doesn't break existing configs, or at least gives a helpful error message.
However, considering the enormous rewrite, this should definitely happen before merging this PR.
Personally, this PR and its direct dependants might be one of the most drastic improvements to this project so far. Thanks for all the work so far!
For reference, the following PRs and issues depend on this PR:
- https://github.com/danth/stylix/issues/131
- https://github.com/danth/stylix/issues/182
- https://github.com/danth/stylix/issues/207
- https://github.com/danth/stylix/issues/208
- https://github.com/danth/stylix/issues/63
- https://github.com/danth/stylix/pull/157
For reference, the following PRs and issues should be improved based on this PR:
- https://github.com/danth/stylix/pull/135
- https://github.com/danth/stylix/pull/175
Feel free to add any PRs or issues I missed and to update the description of this PR to properly link the PRs and issues.