danth / stylix

System-wide colorscheming and typography for NixOS
https://stylix.danth.me/
MIT License
912 stars 107 forks source link

hyprland: set cursor theme #258

Open xokdvium opened 4 months ago

xokdvium commented 4 months ago

Set cursor theme and size in home-manager module via exec-once and hyprctl setcursor.

xokdvium commented 4 months ago

This works reasonably well for me. Without using hyprctl the cursor works fine for xwayland apps, but native apps have incorrect size set. Unfortunately there's a small hiccup when hyprland initially launches the cursor size is incorrect. This resolves itself when I open any window. I suspect this is more an upstream issue with hyprland not reloading the them immediately. This solution works well for me.

trueNAHO commented 4 months ago

Is your stylix.cursor not being applied in Hyprland without this PR?

My stylix.cursor is being properly applied. Maybe my Wayland setup causes the cursor to be applied? In that case we could apply my Wayland setup to Stylix.

xokdvium commented 4 months ago

The cursor package is correct, but the size is not. Not in all cases anyway. For example, when hovering over the firefox (as far as I can tell it's running native wayland) the cursor is set correctly (size is 32). From the about:support page Window Protocol is wayland. But when the cursor is hovering over other applications or the background (hyprland default and swaybg) the size is hyprland's default 24. This patch fixes the issue for me. Although my setup for wayland does not have QT_QPA_PLATFORM=wayland. Maybe that's the culprit

xokdvium commented 4 months ago

Maybe my Wayland setup causes the cursor to be applied?

No, this does not seem to help.

trueNAHO commented 4 months ago

Although my setup for wayland does not have QT_QPA_PLATFORM=wayland.

What about QT_QPA_PLATFORM="wayland;xcb"? Maybe something from https://wiki.archlinux.org/title/wayland is relevant.

xokdvium commented 4 months ago

Although my setup for wayland does not have QT_QPA_PLATFORM=wayland.

What about QT_QPA_PLATFORM "wayland;xcb"?

I did try your home.sessionVariables verbatim with QT_QPA_PLATFORM = "wayland;xcb" and I still saw my original issue. You run 22 cursor size, which is quite close to hyprland's default 24. Can you verify that you don't experience this issue? Seems like a lot of people encounter similar issues on non-nixos systems. Though in that thread the cursor theme also changes, which is not the case for me.

trueNAHO commented 4 months ago

You run 22 cursor size, which is quite close to hyprland's default 24. Can you verify that you don't experience this issue?

I remember the stylix.cursor.size option working last time I defined it. Setting stylix.cursor.size = 52; on my current setup noticabely increases the cursor size upon restarting Hyprland. So it seems like I can define the cursor size how I want.

Maybe my flake.lock versions from both of my cases are relevant? Maybe it's a hardware problem? For reference, I use AMD.

Though in that thread the cursor theme also changes, which is not the case for me.

I remember this being a common problem on my previous Arch Linux setup with X11. However, I don't remember seeing this since I am on Hyprland/NixOS.

trueNAHO commented 4 months ago

Though in that thread the cursor theme also changes, which is not the case for me.

I remember this being a common problem on my previous Arch Linux setup with X11. However, I don't remember seeing this since I am on Hyprland/NixOS.

Out of utter coincidence, I discovered that the X application nix run nixpkgs#catclock changes my cursor to some black default cursor.

trueNAHO commented 3 months ago

Related: