diff --git a/modules/gnome/nixos.nix b/modules/gnome/nixos.nix index 81661767..12232d00 100644 --- a/modules/gnome/nixos.nix +++ b/modules/gnome/nixos.nix @@ -55,15 +55,19 @@ in # Cursor settings are usually applied via Home Manager, # but the login screen uses a separate database. - environment.systemPackages = [ config.stylix.cursor.package ]; - programs.dconf.profiles.gdm.databases = [ - { - lockAll = true; - settings."org/gnome/desktop/interface" = { - cursor-theme = config.stylix.cursor.name; - cursor-size = lib.gvariant.mkInt32 config.stylix.cursor.size; - }; - } + environment.systemPackages = lib.mkIf (config.stylix.cursor != null) [ + config.stylix.cursor.package ]; + programs.dconf.profiles.gdm.databases = + lib.mkIf (config.stylix.cursor != null) + [ + { + lockAll = true; + settings."org/gnome/desktop/interface" = { + cursor-theme = config.stylix.cursor.name; + cursor-size = lib.gvariant.mkInt32 config.stylix.cursor.size; + }; + } + ]; }; } diff --git a/modules/kde/hm.nix b/modules/kde/hm.nix index 01c305d5..5dc01f67 100644 --- a/modules/kde/hm.nix +++ b/modules/kde/hm.nix @@ -280,18 +280,26 @@ let configPackage = pkgs.runCommandLocal "stylix-kde-config" - { - kcminputrc = formatConfig kcminputrc; - kded5rc = formatConfig kded5rc; - kdeglobals = formatConfig kdeglobals; - } - '' - mkdir "$out" + ( + { + kded5rc = formatConfig kded5rc; + kdeglobals = formatConfig kdeglobals; + } + // (lib.optionalAttrs (config.stylix.cursor != null) { + kcminputrc = formatConfig kcminputrc; + }) + ) + ( + '' + mkdir "$out" - printf '%s\n' "$kcminputrc" >"$out/kcminputrc" - printf '%s\n' "$kded5rc" >"$out/kded5rc" - printf '%s\n' "$kdeglobals" >"$out/kdeglobals" - ''; + printf '%s\n' "$kded5rc" >"$out/kded5rc" + printf '%s\n' "$kdeglobals" >"$out/kdeglobals" + '' + + (lib.optionalString ( + config.stylix.cursor != null + ) ''printf '%s\n' "$kcminputrc" >"$out/kcminputrc"'') + ); # plasma-apply-wallpaperimage is necessary to change the wallpaper # after the first login. diff --git a/modules/regreet/nixos.nix b/modules/regreet/nixos.nix index e8476e89..56e0e6fd 100644 --- a/modules/regreet/nixos.nix +++ b/modules/regreet/nixos.nix @@ -51,7 +51,7 @@ in font = { inherit (config.stylix.fonts.sansSerif) name package; }; - cursorTheme = { + cursorTheme = lib.mkIf (config.stylix.cursor != null) { inherit (config.stylix.cursor) name package; }; theme = { diff --git a/modules/river/hm.nix b/modules/river/hm.nix index d2eb77d3..638c641f 100644 --- a/modules/river/hm.nix +++ b/modules/river/hm.nix @@ -15,7 +15,9 @@ border-color-unfocused = "0x${colors.base03}"; border-color-urgent = "0x${colors.base08}"; background-color = "0x${colors.base00}"; - xcursor-theme = "${cursor.name} ${toString cursor.size}"; + xcursor-theme = lib.mkIf ( + config.stylix.cursor != null + ) "${cursor.name} ${toString cursor.size}"; }; }; } diff --git a/modules/sway/hm.nix b/modules/sway/hm.nix index c5c4d042..02230944 100644 --- a/modules/sway/hm.nix +++ b/modules/sway/hm.nix @@ -63,8 +63,9 @@ in output."*".bg = lib.mkIf cfg.useWallpaper "${config.stylix.image} ${config.stylix.imageScalingMode}"; - seat."*".xcursor_theme = - ''"${config.stylix.cursor.name}" ${toString config.stylix.cursor.size}''; + seat."*".xcursor_theme = lib.mkIf ( + config.stylix.cursor != null + ) ''"${config.stylix.cursor.name}" ${toString config.stylix.cursor.size}''; }; }) diff --git a/stylix/cursor.nix b/stylix/cursor.nix index 412cf678..2e6b371d 100644 --- a/stylix/cursor.nix +++ b/stylix/cursor.nix @@ -1,21 +1,26 @@ -{ pkgs, lib, ... }: +{ lib, ... }: { - options.stylix.cursor = { - name = lib.mkOption { - description = "The cursor name within the package."; - type = lib.types.str; - default = "Vanilla-DMZ"; - }; - package = lib.mkOption { - description = "Package providing the cursor theme."; - type = lib.types.package; - default = pkgs.vanilla-dmz; - }; - size = lib.mkOption { - description = "The cursor size."; - type = lib.types.int; - default = 32; - }; + options.stylix.cursor = lib.mkOption { + description = "Attributes defining the systemwide cursor."; + type = lib.types.nullOr ( + lib.types.submodule { + options = { + name = lib.mkOption { + description = "The cursor name within the package."; + type = lib.types.str; + }; + package = lib.mkOption { + description = "Package providing the cursor theme."; + type = lib.types.package; + }; + size = lib.mkOption { + description = "The cursor size."; + type = lib.types.int; + }; + }; + } + ); + default = null; }; } diff --git a/stylix/hm/cursor.nix b/stylix/hm/cursor.nix index 0c04f0d3..f1efa94f 100644 --- a/stylix/hm/cursor.nix +++ b/stylix/hm/cursor.nix @@ -10,11 +10,18 @@ let in { - config = lib.mkIf (config.stylix.enable && pkgs.stdenv.hostPlatform.isLinux) { - home.pointerCursor = { - inherit (cfg) name package size; - x11.enable = true; - gtk.enable = true; - }; - }; + config = + lib.mkIf + ( + config.stylix.enable + && config.stylix.cursor != null + && pkgs.stdenv.hostPlatform.isLinux + ) + { + home.pointerCursor = { + inherit (cfg) name package size; + x11.enable = true; + gtk.enable = true; + }; + }; } diff --git a/stylix/home-manager-integration.nix b/stylix/home-manager-integration.nix index 3f2a10d7..5834ee3b 100644 --- a/stylix/home-manager-integration.nix +++ b/stylix/home-manager-integration.nix @@ -36,21 +36,6 @@ let path = [ "stylix" "cursor" - "name" - ]; - } - { - path = [ - "stylix" - "cursor" - "package" - ]; - } - { - path = [ - "stylix" - "cursor" - "size" ]; } { diff --git a/stylix/nixos/cursor.nix b/stylix/nixos/cursor.nix index bf6853ca..a2fa6b2f 100644 --- a/stylix/nixos/cursor.nix +++ b/stylix/nixos/cursor.nix @@ -1,7 +1,7 @@ { config, lib, ... }: { - config = lib.mkIf config.stylix.enable { + config = lib.mkIf (config.stylix.enable && config.stylix.cursor != null) { environment.variables.XCURSOR_SIZE = toString config.stylix.cursor.size; }; } diff --git a/stylix/testbed.nix b/stylix/testbed.nix index 5a502b34..37bb1a04 100644 --- a/stylix/testbed.nix +++ b/stylix/testbed.nix @@ -142,6 +142,7 @@ let stylix.polarity "image${lib.optionalString (stylix.image or null == null) "less"}" "scheme${lib.optionalString (stylix.base16Scheme or null == null) "less"}" + "cursor${lib.optionalString (stylix.cursor or null == null) "less"}" ] ); @@ -226,6 +227,17 @@ let image = images.dark; polarity = "dark"; } + { + enable = true; + image = images.dark; + base16Scheme = "${inputs.tinted-schemes}/base16/catppuccin-macchiato.yaml"; + polarity = "dark"; + cursor = { + name = "Vanilla-DMZ"; + package = pkgs.vanilla-dmz; + size = 32; + }; + } ]; in