stylix icon indicating copy to clipboard operation
stylix copied to clipboard

hyprland: init `hyprpaper` service

Open edrobertsrayne opened this issue 1 year ago • 3 comments

Add hyprpaper styling using stylix.image as wallpaper.

edrobertsrayne avatar May 21 '24 20:05 edrobertsrayne

IMHO, it would be more structured to add this functionality under an options.stylix.targets.hyprland.wallpaper option, although we might change the wallpaper option name.

I agree, this should be combined with the hyprland module.

However, having a separate option for it would make it different to all other modules, which just use the stylix.image value directly.

danth avatar May 22 '24 07:05 danth

I agree, this should be combined with the hyprland module.

Something like this?

in {
  options.stylix.targets = {
    hyprland.enable = config.lib.stylix.mkEnableTarget "Hyprland" true;
    hyprpaper.enable = config.lib.stylix.mkEnableTarget "Hyprpaper" true;
  };

  config.wayland.windowManager.hyprland.settings =
    lib.mkIf config.stylix.targets.hyprland.enable settings;

  config.services.hyprpaper.settings = lib.mkIf config.stylix.targets.hyprpaper.enable {
    preload = ["${config.stylix.image}"];
    wallpaper = [",${config.stylix.image}"];
  };
}

edrobertsrayne avatar May 22 '24 08:05 edrobertsrayne

IMO, hyprpaper is less of a target itself, and more just the means of theming hyprland. So ideally they should use the same option to enable both.

danth avatar May 22 '24 09:05 danth

Your seemingly unrelated flake.lock changes from eb44e01 are causing build errors in my Home Manager setup, and have been reverted in e722720 to resolve this issues.

Thanks, I inadvertently added these when trying to get a local version of the repo to work in my NixOS flake.

7887ca8 removes the preload statement in attempt to reduce the running memory usage. Take a look at the commit message for more details. However, this causes Hyprpaper not to set the wallpaper anymore, as it is not loaded into memory before setting it. I assume this requires patching an unload option to Home Manager or Hyprpaper such that wallpapers are unloaded right after setting them.

@edrobertsrayne could you resolve this preload issue?

As far as I can tell, this is the expected way that hyprpaper works. You need to manually load the image into memory and then apply it. You can't set a wallpaper without using preload unless I've missed something. See hyprpaper wiki

edrobertsrayne avatar May 28 '24 16:05 edrobertsrayne

7887ca8 removes the preload statement in attempt to reduce the running memory usage. Take a look at the commit message for more details. However, this causes Hyprpaper not to set the wallpaper anymore, as it is not loaded into memory before setting it. I assume this requires patching an unload option to Home Manager or Hyprpaper such that wallpapers are unloaded right after setting them. @edrobertsrayne could you resolve this preload issue?

As far as I can tell, this is the expected way that hyprpaper works. You need to manually load the image into memory and then apply it. You can't set a wallpaper without using preload unless I've missed something. See hyprpaper wiki

Indeed. However, I was thinking about unloading the image after setting it, as it will not be set again. This would reduce the running memory usage.

trueNAHO avatar May 28 '24 17:05 trueNAHO

7887ca8 removes the preload statement in attempt to reduce the running memory usage. Take a look at the commit message for more details. However, this causes Hyprpaper not to set the wallpaper anymore, as it is not loaded into memory before setting it. I assume this requires patching an unload option to Home Manager or Hyprpaper such that wallpapers are unloaded right after setting them. @edrobertsrayne could you resolve this preload issue?

As far as I can tell, this is the expected way that hyprpaper works. You need to manually load the image into memory and then apply it. You can't set a wallpaper without using preload unless I've missed something. See hyprpaper wiki

Indeed. However, I was thinking about unloading the image after setting it, as it will not be set again. This would reduce the running memory usage.

I'm not sure you can do that, or at least should. The image has got to be in memory somewhere to be displayed and looking through the wiki it seems like the important option is unload unused. The unload command is a runtime command rather than a configuration option.

edrobertsrayne avatar May 28 '24 19:05 edrobertsrayne

7887ca8 removes the preload statement in attempt to reduce the running memory usage. Take a look at the commit message for more details. However, this causes Hyprpaper not to set the wallpaper anymore, as it is not loaded into memory before setting it. I assume this requires patching an unload option to Home Manager or Hyprpaper such that wallpapers are unloaded right after setting them.

I'm not sure you can do that, or at least should. The image has got to be in memory somewhere to be displayed and looking through the wiki it seems like the important option is unload unused. The unload command is a runtime command rather than a configuration option.

This should be addressed in a follow-up PR, if at all. Feel free to revert 7887ca8, so this feature can be merged.

I opened https://github.com/danth/stylix/issues/408, to investigate this issue further once I have more free time.

trueNAHO avatar May 31 '24 22:05 trueNAHO

IMO, hyprpaper is less of a target itself, and more just the means of theming hyprland. So ideally they should use the same option to enable both.

This is wrong, hyprpaper works perfectly well as a standalone service for all wlroots-based compositors. It should be a separate target.

diniamo avatar Jun 04 '24 21:06 diniamo

This is wrong, hyprpaper works perfectly well as a standalone service for all wlroots-based compositors. It should be a separate target.

Depends whether we're only setting it up when it's already been enabled, or if we're also installing it by default. If we removed the services.hyprpaper.enable = true line then I would support it being separate.

On the other hand, enabling the service automatically is helpful for Hyprland users who expect the wallpaper to "just work".

danth avatar Jun 05 '24 13:06 danth

Users who except things to just work will not be using nix and a compositor IMO.

Either way, at least have it as a separate target, and enable that in the Hyprland one.

diniamo avatar Jun 05 '24 13:06 diniamo

Me? This isn't my PR.

diniamo avatar Jun 06 '24 20:06 diniamo

Me? This isn't my PR.

My bad. I pinged the wrong person.

trueNAHO avatar Jun 06 '24 23:06 trueNAHO