catppuccin / nix

❄️ Soothing pastel theme for Nix
https://nix.catppuccin.com/
MIT License
302 stars 46 forks source link

Hyprcursor theme is set to "MyCursor" #236

Open Different-Name opened 2 weeks ago

Different-Name commented 2 weeks ago

https://github.com/catppuccin/nix/blob/73e06d5bd7ed34bdd0168030893ef8364fdc1d4a/modules/home-manager/hyprland.nix#L30

The hyprland module sets up environmental variables for the cursor, however these are overwritten later where the example code from the hyprland wiki is added to the hyprland config, setting the cursor theme to MyCursor instead of catppuccin-${cursor.flavor}-${cursor.accent}-cursors

isabelroses commented 2 weeks ago

Why do you have the example config still is my only question. Should you have removed that when configuring your config. wayland.windowManager.hyprland.settings or perhaps using wayland.windowManager.hyprland.extraConfig?

Different-Name commented 2 weeks ago

I'm not sure what you mean. I haven't provided my config, I've only referenced the module provided by this repo

isabelroses commented 2 weeks ago

Yeah, but when you use either those modules, or even create your own ~/.config/hypr/hyprland.conf file the default example settings won't exist anymore. So I cannot see how this could be an issue.

Different-Name commented 2 weeks ago

I have my own config set up through home manager using wayland.windowManager.hyprland.settings I am not using hyperland's default configuration The hyprland module from this repo is adding the example code I linked into my configuration file, shown by the line I referenced in the issue Am I missing a setting in the module?

danielgafni commented 2 weeks ago

I'm experiencing exactly the same problem. I was wondering why did my cursor break without me touching any settings around it.

Turns out, the hyprland module from cattpuccin-nix

  1. Automatically enables hyprcursors
  2. Adds an import to my hyprland.conf like:
source=/nix/store/aan4vsxbqpg5y6l6nyqw91hk217sbnpq-hyprland-cursors.conf

And the referenced file contains:

› cat /nix/store/aan4vsxbqpg5y6l6nyqw91hk217sbnpq-hyprland-cursors.conf  
env = HYPRCURSOR_THEME,MyCursor
env = HYPRCURSOR_SIZE,24

I can see this is done here.

P.S. hardcoding 24 cursor size here also doesn't seem to be correct.

Different-Name commented 2 weeks ago

Yes, this is the same issue I am experiencing. I believe it is a fault with the module @isabelroses

isabelroses commented 2 weeks ago
  1. Automatically enables hyprcursors

No... thats just hyprland having hyprcursor enabled by default, you can disable it like so.

cursor {
  enable_hyprcursor = false
}

See https://wiki.hyprland.org/Configuring/Variables/#cursor

 › cat /nix/store/aan4vsxbqpg5y6l6nyqw91hk217sbnpq-hyprland-cursors.conf  
 env = HYPRCURSOR_THEME,MyCursor
 env = HYPRCURSOR_SIZE,24

After a bit of reading I see that MyCursor would be the fall back so we can just set that also to catppuccin-${cursor.flavor}-${cursor.accent}-cursors".

P.S. hardcoding 24 cursor size here also doesn't seem to be correct.

This we can mkDefault to fix that issue.

As a side note my best guess as to why its failing for you is because you're using an older version of nixpkgs that does not have the hyprcursor theme.

Different-Name commented 2 weeks ago

I'm on a recent commit of the unstable branch - https://github.com/NixOS/nixpkgs/commit/e9ee548d90ff586a6471b4ae80ae9cfcbceb3420

danielgafni commented 2 weeks ago

Oh, thanks, I didn't know hyprland enabled hyprcursors by default.

As a side note my best guess as to why its failing for you is because you're using an older version of nixpkgs that does not have the hyprcursor theme.

Nope, I'm on unstable and I have these packages built.

I believe the problem was (partially) in using the old cursor theme name with capital letters. I changed it to lowercase and the cursor works now.

However, I'm not sure if I've done everything correctly. I don't even think hyprcursors is picking anything up at all, because HYPRCURSOR_SIZE and HYPRCURSOR_THEME does not affect anything.

Only home.pointerCursor.name & ome.pointerCursor.package affect the theme generated in ~/.icons / ~/.local/share/icons.

Honestly, I'm quite confused by relations between home.pointerCursor, gtk.cursorTheme, and gtk.catppuccin.cursor.

gtk.catppuccin.cursor is setting HYPRCURSOR_THEME, but again, it's not really being picked up by hyprland. Clearly something is wrong on my side...

I believe I still have an xcursor cursor in use.

isabelroses commented 2 weeks ago

I believe the problem was (partially) in using the old cursor theme name with capital letters. I changed it to lowercase and the cursor works now.

Casing will be the downfall of catppuccin istg.

Honestly, I'm quite confused by relations between home.pointerCursor, gtk.cursorTheme, and gtk.catppuccin.cursor.

home.pointerCursor Is a global alias in home-manager to setup all the cursor theming, which includes gtk.cursorTheme, catppuccin's gtk.catppuccin.cursor applies only the gtk.cursorTheme and not globally unlike home.pointerCursor which is why https://github.com/catppuccin/nix/pull/195 exists.

danielgafni commented 2 weeks ago

Thank you for the explanation!

Mange commented 1 week ago

I'm not sure I get it, still.

Here's what the generated config will do:

  1. The environment variables are set up with the user's values.

    https://github.com/catppuccin/nix/blob/1adbfeb44a54be0ae79eca751ba948a6faa3bb0f/modules/home-manager/hyprland.nix#L14-L16

  2. Hyprland is then injected with statements that overwrite those values with placeholders.

    https://github.com/catppuccin/nix/blob/1adbfeb44a54be0ae79eca751ba948a6faa3bb0f/modules/home-manager/hyprland.nix#L28-L33

So spawning hyprcursor as a normal user will see the correct environment variables, but the Hyprland process, and any children spawned by it, will see MyCursor instead of the real value.

Why? Should I manually add env= statements to my extra config after this to go back to the real values again?