diff options
author | Katharina Fey <kookie@spacekookie.de> | 2019-10-05 12:06:29 +0000 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2019-10-05 12:42:50 +0000 |
commit | 1148b1d122bc03e9a3665856c9b7bb96bd4e3994 (patch) | |
tree | 1a9586de593790e236349d5caa0abdff7f3f6856 /home-manager/modules/xcursor.nix | |
parent | 919d4e75699aa4ba456fd2d3d416a0522c9c7294 (diff) | |
parent | 8bddc1adab0f7a51476f819fa2197353e8e1d136 (diff) |
Add 'home-manager/' from commit '8bddc1adab0f7a51476f819fa2197353e8e1d136'
git-subtree-dir: home-manager
git-subtree-mainline: 919d4e75699aa4ba456fd2d3d416a0522c9c7294
git-subtree-split: 8bddc1adab0f7a51476f819fa2197353e8e1d136
Diffstat (limited to 'home-manager/modules/xcursor.nix')
-rw-r--r-- | home-manager/modules/xcursor.nix | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/home-manager/modules/xcursor.nix b/home-manager/modules/xcursor.nix new file mode 100644 index 00000000000..171586028cd --- /dev/null +++ b/home-manager/modules/xcursor.nix @@ -0,0 +1,83 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.xsession.pointerCursor; + + 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."; + }; + + defaultCursor = mkOption { + type = types.str; + default = "left_ptr"; + example = "X_cursor"; + description = "The default cursor file to use within the package."; + }; + }; + }; + +in + +{ + meta.maintainers = [ maintainers.league ]; + + options = { + xsession.pointerCursor = mkOption { + type = types.nullOr cursorType; + default = null; + description = '' + The X cursor theme and settings. The package + <varname>xorg.xcursorthemes</varname> contains cursors named + whiteglass, redglass, and handhelds. The package + <varname>vanilla-dmz</varname> contains cursors named Vanilla-DMZ + and Vanilla-DMZ-AA. Note: handhelds does not seem to work at + custom sizes. + ''; + }; + }; + + config = mkIf (cfg != null) { + + home.packages = [cfg.package]; + + xsession.initExtra = '' + ${pkgs.xorg.xsetroot}/bin/xsetroot -xcf ${cfg.package}/share/icons/${cfg.name}/cursors/${cfg.defaultCursor} ${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; + }; + + }; +} |