How to fix cursor size?

For the most part, I’ve managed to get a pretty solid DPI scaling setup for my Retina display (dotfiles).

What I can’t figure out, however, is how to make my cursor bigger.
It’s tiny, half the size it should be.

I’ve tried setting XCURSOR_SIZE, to no avail.

1 Like

I use the following line in my config to set the cursor size to 128:

services.xserver.displayManager.sessionCommands = ''
${pkgs.xlibs.xsetroot}/bin/xsetroot -cursor_name ${pkgs.vanilla-dmz}/share/icons/Vanilla-DMZ/cursors/left_ptr 128 &disown

but I do not know whether this is best practice (it is obviously slightly hacky). It also has problems that the size is smaller when hovering above some windows (e.g. urxvt).

@maxhbr that fixes the cursor on the desktop, but the cursor is still tiny after hovering over my terminal (kitty) or web browser (firefox) :-/

I’m looking to do the same thing. Did you ever find a solution?

Looking for the solution for the exact same question. Is @maxhbr command the way to go?

Check my solution

1 Like

Anyone found a solution on this?

I already setup .xsession.pointerCursor`

Hello! I have a solution for high-dpi machines using Xorg.
My setup is:

OS: NixOS 23.11.20240320.f091af0 (Tapir) x86_64
Resolution: 3840x2160
DE: none+i3
WM: i3

These issues can be solved by editing configuration.nix.

After solving DPI for app & desktop scale, I found the default cursor is still not scaled automatically.

The solution was to modify XCURSOR_SIZE and set services.xserver.upscaleDefaultCursor = true.

Altogether, the relevant portion of my config looks like:

  services.xserver.dpi = 220; # default 96
  services.xserver.upscaleDefaultCursor = true; # default false
  environment.variables = {
    GDK_SCALE = "2.2"; # default 1 I think
    GDK_DPI_SCALE = "0.4"; # default 1 I think
    _JAVA_OPTIONS = "-Dsun.java2d.uiScale=2.2"; # default 1 I think
    XCURSOR_SIZE = "64"; # default 16 I think

Now the cursor is the right size, but only after a user signs in - I think this is because the cursor is over-written by my display manager (login manager) lightdm.

I can conclude that, if you use lightdm, the cursor will have to be configured separately using its settings (see Search - MyNixOS for options). This may also be the case for other login managers too.

1 Like