2018-02-02 04:37:45 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.xsession.pointerCursor;
|
|
|
|
|
|
|
|
cursorType = types.submodule {
|
|
|
|
options = {
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
2021-10-09 09:14:08 +00:00
|
|
|
example = literalExpression "pkgs.vanilla-dmz";
|
2018-02-02 04:37:45 +00:00
|
|
|
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.";
|
|
|
|
};
|
2018-05-05 20:50:08 +00:00
|
|
|
|
|
|
|
defaultCursor = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "left_ptr";
|
|
|
|
example = "X_cursor";
|
|
|
|
description = "The default cursor file to use within the package.";
|
|
|
|
};
|
2018-02-02 04:37:45 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-02-01 23:39:17 +00:00
|
|
|
in {
|
2018-02-02 04:37:45 +00:00
|
|
|
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) {
|
2021-07-07 21:24:27 +00:00
|
|
|
assertions = [
|
|
|
|
(hm.assertions.assertPlatform "xsession.pointerCursor" pkgs
|
|
|
|
platforms.linux)
|
|
|
|
];
|
2018-02-02 04:37:45 +00:00
|
|
|
|
2022-03-17 19:30:48 +00:00
|
|
|
warnings = [''
|
|
|
|
GTK cursor settings will no longer be handled in the xsession.pointerCursor module in future.
|
|
|
|
Please use gtk.cursorTheme for GTK cursor settings instead.
|
|
|
|
''];
|
|
|
|
|
2020-02-01 23:39:17 +00:00
|
|
|
home.packages = [ cfg.package ];
|
2018-02-02 04:37:45 +00:00
|
|
|
|
|
|
|
xsession.initExtra = ''
|
2020-02-01 23:39:17 +00:00
|
|
|
${pkgs.xorg.xsetroot}/bin/xsetroot -xcf ${cfg.package}/share/icons/${cfg.name}/cursors/${cfg.defaultCursor} ${
|
|
|
|
toString cfg.size
|
|
|
|
}
|
2018-02-02 04:37:45 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
xresources.properties = {
|
|
|
|
"Xcursor.theme" = cfg.name;
|
2020-02-01 23:39:17 +00:00
|
|
|
"Xcursor.size" = cfg.size;
|
2018-02-02 04:37:45 +00:00
|
|
|
};
|
|
|
|
|
2022-03-17 19:30:48 +00:00
|
|
|
# TODO: deprecate after next version release.
|
|
|
|
gtk.cursorTheme = { inherit (cfg) package name size; };
|
2018-02-02 04:37:45 +00:00
|
|
|
|
2021-06-07 22:00:31 +00:00
|
|
|
# Set name in icons theme, for compatibility with AwesomeWM etc. See:
|
|
|
|
# https://github.com/nix-community/home-manager/issues/2081
|
|
|
|
# https://wiki.archlinux.org/title/Cursor_themes#XDG_specification
|
|
|
|
home.file.".icons/default/index.theme".text = ''
|
|
|
|
[icon theme]
|
|
|
|
Name=Default
|
|
|
|
Comment=Default Cursor Theme
|
|
|
|
Inherits=${cfg.name}
|
|
|
|
'';
|
2018-02-02 04:37:45 +00:00
|
|
|
};
|
|
|
|
}
|