Skip to content

Instantly share code, notes, and snippets.

@themattchan
Created November 18, 2018 05:24
Show Gist options
  • Save themattchan/55d21a524955111913afd7e1e22ce811 to your computer and use it in GitHub Desktop.
Save themattchan/55d21a524955111913afd7e1e22ce811 to your computer and use it in GitHub Desktop.
nixos: fix cursor size

Fix cursor size in nixos/linux

  1. Set your XCURSOR_SIZE to 32 (or desired size) in either your /etc/nixos/configuration.nix
environment.variables.XCURSOR_SIZE = "32";

or ~/.Xresources:

Xcursor.size: 32
  1. in ~/.Xresources, set the theme to Adwaita. (You'd want the gnome3.adwaita-icon-theme nix package installed.)
Xcursor.theme: Adwaita
  1. in ~/.gtkrc-2.0 set the following:
gtk-cursor-theme-name="Adwaita"
gtk-cursor-theme-size=32
  1. in ~/.config/gtk-3.0/settings.ini set the following:
gtk-cursor-theme-name=Adwaita
gtk-cursor-theme-size=32
  1. Logout and log back in. (If you changed /etc/nixos/configuration.nix do a sudo nix-rebuild switch and reboot.)

Change the size and theme as desired -- just make sure that the settings in the above files are in sync.

@pmyjavec
Copy link

pmyjavec commented Feb 6, 2020

@themattchan you suggestions mostly worked for me, but only after I installed the icons from the following package.

gnome3.adwaita-icon-theme

Everything worked after this, thanks for taking the time to document the fix.

To others who are frustrated none of these settings work, it's probably because you don't have an icon theme to use installed. Especially if you're and i3 user.

@ivanbrennan
Copy link

@themattchan Thanks for documenting this!

When I stopped using a desktop environment, I started getting a big old "X" cursor in some contexts (e.g. hovering over a zoomable image in chrome), even though I had set my default XCursor to the left pointer. The only other documentation/examples I found were in the context of home-manager, which I don't use.

Your suggestions fixed the issue and taught me a little more about how cursor themes are managed.

@amarshall
Copy link

If using Home Manager, then this is encapsulated by e.g.

{ pkgs, ... }: {
  xsession.pointerCursor = {
    name = "Adwaita";
    package = pkgs.gnome.adwaita-icon-theme;
    size = 32;
  };
}

Despite being "xsession", Wayland desktops benefit from some of what this does as well.

@leana8959
Copy link

I got the notification that xsession.pointerCursor is being deprecated, and I found the new option here https://nix-community.github.io/home-manager/options.xhtml#opt-home.pointerCursor
Hope this helps :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment