Cursor size in wayland/sway

I’m using wayland/sway and find that my cursor size changes when hovering over different windows. It is smaller on window borders than on most “regular” windows. It is tiny when hoving over a mpv window. Does somebody know the reason for this?

1 Like

Did you ever find a solution? It’s driving me crazy

No, unfortunately not

I managed to find the culprit of my particular issue, I’m not sure if yours is the same:
https://github.com/hyprwm/Hyprland/issues/1577#issuecomment-1436033647

Other than that I’ve seen a lot of people recommend to set XCUSOR_SIZE=size env variable for XWayland/Flatpak apps to maintain consistency:
https://www.reddit.com/r/kde/comments/sumh0u/comment/j95h75o/

Also, using Home Manager allowed me to set the cursor theme for GDK globally (I haven’t tested any QT apps with this though). This way I don’t have to define the cursor theme in gtk.cursorTheme or my .config:

home.pointerCursor = {
  gtk.enable = true;
  package = pkgs.bibata-cursors;
  name = "Bibata-Modern-Ice";
  size = 22;
};

Hope this helps!
If you find any other workaround to your issue, make sure to update this thread so others can learn :slight_smile:

1 Like

I think we have different issues - if I understood you right, your mouse cursor slightly changed size when moving, even within the same window. What I see is that the cursor size can be way different depending on the window it’s hovering.

Regarding my issue:

As far as I understand, in wayland every application is responsible for drawing the cursor hovering over its windows, so I would have to teach each application how to use the correct size.

I found various places indicating that some applications read the XCURSOR_SIZE environment variable and scale the cursor accordingly, but some quick experiments didn’t confirm this for mpv, alacritty and gedit.

Thanks for posting this. My mouse cursor would disappear whenever I opened Wezterm, but this brought it back… although I went with Vanilla-DMZ. Strangely enough, this cursor only works inside the window and then immediately switches back to GNOME’s default cursor outside of it.