1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-14 15:19:45 +01:00
home-manager/modules/config/home-cursor.nix

183 lines
5.7 KiB
Nix
Raw Normal View History

home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.home.pointerCursor;
pointerCursorModule = types.submodule {
options = {
package = mkOption {
type = types.package;
example = literalExpression "pkgs.vanilla-dmz";
description = "Package providing the cursor theme.";
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
};
name = mkOption {
type = types.str;
example = "Vanilla-DMZ";
description = "The cursor name within the package.";
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
};
size = mkOption {
type = types.int;
default = 32;
example = 64;
description = "The cursor size.";
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
};
x11 = {
enable = mkEnableOption ''
x11 config generation for {option}`home.pointerCursor`
'';
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
defaultCursor = mkOption {
type = types.str;
default = "left_ptr";
example = "X_cursor";
description = "The default cursor file to use within the package.";
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
};
};
gtk = {
enable = mkEnableOption ''
gtk config generation for {option}`home.pointerCursor`
'';
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
};
};
};
cursorPath = "${cfg.package}/share/icons/${escapeShellArg cfg.name}/cursors/${
escapeShellArg cfg.x11.defaultCursor
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
}";
defaultIndexThemePackage = pkgs.writeTextFile {
name = "index.theme";
destination = "/share/icons/default/index.theme";
# 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
text = ''
[Icon Theme]
Name=Default
Comment=Default Cursor Theme
Inherits=${cfg.name}
'';
};
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
in {
meta.maintainers = [ maintainers.polykernel maintainers.league ];
imports = [
(mkAliasOptionModule [ "xsession" "pointerCursor" "package" ] [
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
"home"
"pointerCursor"
"package"
])
(mkAliasOptionModule [ "xsession" "pointerCursor" "name" ] [
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
"home"
"pointerCursor"
"name"
])
(mkAliasOptionModule [ "xsession" "pointerCursor" "size" ] [
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
"home"
"pointerCursor"
"size"
])
(mkAliasOptionModule [ "xsession" "pointerCursor" "defaultCursor" ] [
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
"home"
"pointerCursor"
"x11"
"defaultCursor"
])
({ ... }: {
warnings = optional (any (x:
getAttrFromPath
([ "xsession" "pointerCursor" ] ++ [ x ] ++ [ "isDefined" ])
options) [ "package" "name" "size" "defaultCursor" ]) ''
The option `xsession.pointerCursor` has been merged into `home.pointerCursor` and will be removed
in the future. Please change to set `home.pointerCursor` directly and enable `home.pointerCursor.x11.enable`
to generate x11 specific cursor configurations. You can refer to the documentation for more details.
'';
})
];
options = {
home.pointerCursor = mkOption {
type = types.nullOr pointerCursorModule;
default = null;
description = ''
Cursor configuration. Set to `null` to disable.
2023-01-24 11:30:04 +01:00
Top-level options declared under this submodule are backend independent
options. Options declared under namespaces such as `x11`
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
are backend specific options. By default, only backend independent cursor
configurations are generated. If you need configurations for specific
backends, you can toggle them via the enable option. For example,
[](#opt-home.pointerCursor.x11.enable)
will enable x11 cursor configurations.
Note that this will merely generate the cursor configurations.
To apply the configurations, the relevant subsytems must also be configured.
For example, [](#opt-home.pointerCursor.gtk.enable) will generate
the gtk cursor configuration, but [](#opt-gtk.enable) needs
to be set for it to be applied.
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
'';
};
};
config = mkIf (cfg != null) (mkMerge [
{
assertions = [
(hm.assertions.assertPlatform "home.pointerCursor" pkgs platforms.linux)
];
home.packages = [ cfg.package defaultIndexThemePackage ];
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
# Set directory to look for cursors in, needed for some applications
# that are unable to find cursors otherwise. See:
# https://github.com/nix-community/home-manager/issues/2812
# https://wiki.archlinux.org/title/Cursor_themes#Environment_variable
home.sessionVariables = {
XCURSOR_PATH = mkDefault ("$XCURSOR_PATH\${XCURSOR_PATH:+:}"
+ "${config.home.profileDirectory}/share/icons");
XCURSOR_SIZE = mkDefault cfg.size;
XCURSOR_THEME = mkDefault cfg.name;
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
};
# Add symlink of cursor icon directory to $HOME/.icons, needed for
# backwards compatibility with some applications. See:
# https://specifications.freedesktop.org/icon-theme-spec/latest/ar01s03.html
home.file.".icons/default/index.theme".source =
"${defaultIndexThemePackage}/share/icons/default/index.theme";
home.file.".icons/${cfg.name}".source =
"${cfg.package}/share/icons/${cfg.name}";
# Add cursor icon link to $XDG_DATA_HOME/icons as well for redundancy.
xdg.dataFile."icons/default/index.theme".source =
"${defaultIndexThemePackage}/share/icons/default/index.theme";
xdg.dataFile."icons/${cfg.name}".source =
"${cfg.package}/share/icons/${cfg.name}";
home.pointerCursor: init (#2891) * home.pointerCursor: init The current architecture for cursor configurations is composed of individual options for different backends. For example, X specific settings are managed under `xsession.pointerCursor` and gtk specific settings are managed under `gtk.cursorTheme`. While this architecture is modular, it causes duplication of similar structures for each component. In theory, this provides flexibility because the components are independent of each other which can be arranged in arbitrary ways to achieve the desired result. However in practice, users wish to have one cursor theme applied to their entire system The duplication of options correspond to duplication of settings on the user side and it becomes a burden to keep track of all necessary settings. This commit is an attempt to unify cursor configurations for different window systems and GUI toolkits based on https://github.com/nix-community/home-manager/pull/2481#issuecomment-978917480. `home.pointerCursor` is introduced as the interface for all cursor configurations. It contain all options relevant to cursor themes with eneral options delcared under `home.pointerCursor.*` and backend specific options declared under `home.pointerCursor.<backend>.*`. By default, a backend independent configuration is generated. Backend specific configurations can be toggled via the `home.pointerCursor.<backend>.enable` option for each backend. This was decided over using a list of enums because it allows easy access to the state of the backend. Note generating different cursor configurations for different backends is still possible by defining only `home.pointerCursor` and managing the respective options manually. * xcursor: migrate options to home.pointerCursor - Removed `xession.pointerCursor` as x11 cursor configurations are now handled in `home.pointerCursor.x11`. - Updated `meta.maintainer` field in `home.pointerCursor` and CODEOWNERS.
2022-05-04 00:29:17 +02:00
}
(mkIf cfg.x11.enable {
xsession.initExtra = ''
${pkgs.xorg.xsetroot}/bin/xsetroot -xcf ${cursorPath} ${
toString cfg.size
}
'';
xresources.properties = {
"Xcursor.theme" = cfg.name;
"Xcursor.size" = cfg.size;
};
})
(mkIf cfg.gtk.enable {
gtk.cursorTheme = mkDefault { inherit (cfg) package name size; };
})
]);
}