From e5ac21ffb24b5c28f5400a645c2748ab2b14eaae Mon Sep 17 00:00:00 2001 From: Christopher League Date: Thu, 1 Feb 2018 23:37:45 -0500 Subject: [PATCH] xcursor: new module for configuring X cursor theme --- modules/modules.nix | 1 + modules/xcursor.nix | 72 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 modules/xcursor.nix diff --git a/modules/modules.nix b/modules/modules.nix index 7fd76147..db71ece4 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -64,6 +64,7 @@ let ./services/window-managers/xmonad.nix ./services/xscreensaver.nix ./systemd.nix + ./xcursor.nix ./xresources.nix ./xsession.nix diff --git a/modules/xcursor.nix b/modules/xcursor.nix new file mode 100644 index 00000000..013cbe07 --- /dev/null +++ b/modules/xcursor.nix @@ -0,0 +1,72 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.xcursor; + + cursorType = types.submodule { + options = { + package = mkOption { + type = types.package; + example = literalExample "pkgs.vanilla-dmz"; + description = "Package providing the cursor theme."; + }; + + name = mkOption { + type = types.str; + example = "Vanilla-DMZ"; + description = "The cursor name within the package."; + }; + + size = mkOption { + type = types.int; + default = 32; + example = 64; + description = "The cursor size."; + }; + }; + }; + +in + +{ + meta.maintainers = [ maintainers.league ]; + + options = { + xcursor = mkOption { + type = types.nullOr cursorType; + default = null; + description = '' + The X cursor theme to use. + ''; + }; + }; + + config = mkIf (cfg != null) { + + home.packages = [cfg.package]; + + xsession.initExtra = '' + ${pkgs.xorg.xsetroot}/bin/xsetroot -xcf ${cfg.package}/share/icons/${cfg.name}/cursors/X_cursor ${toString cfg.size} + ''; + + xresources.properties = { + "Xcursor.theme" = cfg.name; + "Xcursor.size" = cfg.size; + }; + + gtk.gtk2.extraConfig = '' + gtk-cursor-theme-name="${cfg.name}" + gtk-cursor-theme-size=${toString cfg.size} + ''; + + gtk.gtk3.extraConfig = { + "gtk-cursor-theme-name" = cfg.name; + "gtk-cursor-theme-size" = cfg.size; + }; + + + }; +}