stylix icon indicating copy to clipboard operation
stylix copied to clipboard

treewide: wallpaper refactor

Open SomeGuyNamedMay opened this issue 2 years ago • 23 comments

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

SomeGuyNamedMay avatar May 31 '23 00:05 SomeGuyNamedMay

running into this weird error when building docs error.txt

SomeGuyNamedMay avatar Jun 07 '23 21:06 SomeGuyNamedMay

ready for review when you've got time.

SomeGuyNamedMay avatar Jun 12 '23 01:06 SomeGuyNamedMay

@danth i think this is ready whenever you have time

SomeGuyNamedMay avatar Jun 22 '23 19:06 SomeGuyNamedMay

We need to update the configuration page on the website to use the new constructors

danth avatar Jul 02 '23 22:07 danth

do we want to run checks on that wallpaper types that ensures there contents are of the correct types?

SomeGuyNamedMay avatar Jul 03 '23 06:07 SomeGuyNamedMay

That would be good if possible

danth avatar Jul 03 '23 07:07 danth

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.

danth avatar Jul 09 '23 18:07 danth

yea i thought about that as well, ill differ to you on that one.

SomeGuyNamedMay avatar Jul 09 '23 18:07 SomeGuyNamedMay

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.)

wbg wallpaper

It would look better if the image was cropped rather than squashed, which is what swww does by default.

swww wallpaper

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 avatar Jul 14 '23 12:07 danth

@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

SomeGuyNamedMay avatar Jul 22 '23 23:07 SomeGuyNamedMay

I feel like Hyprland might be better left for a separate pull request - this one is almost ready to merge.

danth avatar Jul 23 '23 17:07 danth

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

danth avatar Sep 10 '23 20:09 danth

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?

SomeGuyNamedMay avatar Oct 01 '23 04:10 SomeGuyNamedMay

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.

SomeGuyNamedMay avatar Oct 01 '23 04:10 SomeGuyNamedMay

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

danth avatar Oct 01 '23 09:10 danth

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.

danth avatar Oct 08 '23 18:10 danth

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.

SomeGuyNamedMay avatar Oct 09 '23 18:10 SomeGuyNamedMay

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.

danth avatar Oct 09 '23 20:10 danth

went ahead and put the wallpaper in etc/stylix and .config/stylix for unsupported modules

SomeGuyNamedMay avatar Oct 09 '23 22:10 SomeGuyNamedMay

Some more things I want to try:

  • Using the new type system for opacity, so you can write config.stylix.opacity.desktop.as.float and 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.stylix to 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.

danth avatar Dec 03 '23 22:12 danth

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 avatar Dec 26 '23 01:12 Sntx626

@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.

danth avatar Dec 29 '23 20:12 danth

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.

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.

trueNAHO avatar Jan 12 '24 14:01 trueNAHO