stylix icon indicating copy to clipboard operation
stylix copied to clipboard

Use of hyprcursor for hyprland

Open Eddio0141 opened this issue 1 year ago • 10 comments

https://wiki.hyprland.org/Hypr-Ecosystem/hyprcursor/

I don't see anything related to hyprcursor here, so I'm opening this Is there a reason it's not used? Or was this just not added yet

Eddio0141 avatar Jul 21 '24 05:07 Eddio0141

I don't see anything related to hyprcursor here, so I'm opening this

Thanks for pointing this out!

Is there a reason it's not used? Or was this just not added yet

It was just not added yet.

trueNAHO avatar Jul 21 '24 13:07 trueNAHO

From the page you linked, I get the impression that Hyprcursor is simply an alternative file format for cursor themes. Are there any benefits to supporting this compared to using the traditional Xcursor format? According to the page, Hyprland supports both and will fall back to the traditional format if Hyprcursor is not configured.

danth avatar Jul 21 '24 22:07 danth

You can read https://github.com/hyprwm/hyprcursor for more information, but as far as I know, its overall better than xcursor Hyprland itself has it built in already and only needs 2 env vars to enable it, so I don't see any downsides to adding this

Eddio0141 avatar Jul 22 '24 00:07 Eddio0141

The main downside is that Xcursor will still be required for other compositors / apps which don't support Hyprcursor, so we have to support both formats as well as converting between them if possible

danth avatar Jul 22 '24 13:07 danth

IMHO, Vaxry's high-quality projects might eventually become the standard.

The main downside is that Xcursor will still be required for other compositors / apps which don't support Hyprcursor

Users not switching fully to Vaxry's ecosystem would face system bloat from duplicating functionalities.

Would it be a good idea to integrate Hyprcursor into the Stylix Hyprland module?

trueNAHO avatar Jul 22 '24 14:07 trueNAHO

I support adding support for hyprcursors, but I am not sure if there are any hyprcursor themes in nixpkgs at the moment to test stylix support with.

I use bibata-cursors nixpkg, and it does not have a hyprcursor variant generated in it's output.

Someone could implement an overridable parameter for the bibata-cursors package that will allow to switch between cursor formats that are being generated.

Maybe somerthing like this will be approved by package maintainers:

cursor.package = pkgs.bibata-cursors; # cursorFormat is set to xcursor by default for backwards compatibility
cursor.package = pkgs.bibata-cursors.override { cursorFormat = "xcursor"; };
cursor.package = pkgs.bibata-cursors.override { cursorFormat = "hyprcursor"; };

To do that one will have to wait until clickgen supports hyprcursors and I think that it will because the issue for this is opened by the maintainer.

jaredmontoya avatar Jul 28 '24 19:07 jaredmontoya

I think we could get away with something a lot simpler. Hyprcursor provides hyprcursor-util which enables us to convert any xcursor packages to a hyprcursor compatible version.

So let's say the user specifies something like:

cursor.package = pkgs.bibata-cursors;

And then the cursors get installed somewhere like ~/.icons/bibata-cursors.

Then we could run:

# extract intermediate "working state"
hyprcursor-util -x ~/.icons/bibata-cursors -o ~/.icons/bibata-cursors-temp
# generate the hyprcursor compatible version
hyprcursor-util -c ~/.icons/bibata-cursors-temp -o ~/.icons/bibata-cursors-hypr
# remove leftover intermediate state
rm -rf ~/.icons/bibata-cursor-temp

Then we can just tell hyprland to use ~/.icons/bibata-cursors-hypr. This way, the user only needs to specify an xcursor theme, and the rest happens auto-magically.

colexbruhn avatar Aug 05 '24 05:08 colexbruhn

I am not an expert in cursors so correct me if I am wrong.

As far as I know:

  1. xcursor format is a collection of raster images.
  2. hyprcursor allows to render the cursor from SVGs.
  3. if 1 is true and we convert xcursor to hyprcursor the resulting hyprcursor will not be infinitely crisp as a hyprcursor built from "source SVGs" defeating the purpose of using hyprcursor in the first place.

jaredmontoya avatar Aug 05 '24 13:08 jaredmontoya

Yes, converting Xcursor to Hyprcursor has no benefits as far as I can see, since Hyprland can load Xcursor directly anyway. Conversion in the other direction could be useful however.

See here (taken from #102) for an attempt at supporting different file formats under the same option, with automatic conversion between them - we may want to use something similar here.

danth avatar Aug 05 '24 16:08 danth

Related:

  • https://blog.vaxry.net/articles/2024-cursors
  • https://github.com/hyprwm/Hyprland/releases/tag/v0.37.0

-- https://github.com/danth/stylix/pull/258#issuecomment-2019126625

trueNAHO avatar Aug 10 '24 14:08 trueNAHO

It looks like this is part of home-manager now (added in https://github.com/nix-community/home-manager/pull/5699), so I think supporting it should be as simple as enabling it in hm/cursor.nix?

aouerf avatar Jan 02 '25 03:01 aouerf

Are there any hyprcursor themes in nixpkgs? I use bibata-cursors but it contains only the xcursor variant.

jaredmontoya avatar Jan 02 '25 14:01 jaredmontoya

Are there any hyprcursor themes in nixpkgs? I use bibata-cursors but it contains only the xcursor variant.

I'm pretty sure catppuccin-cursors supports hyprcursor.

aouerf avatar Jan 02 '25 15:01 aouerf