diff --git a/modules/sway/hm.nix b/modules/sway/hm.nix index 11d51294..10e5e877 100644 --- a/modules/sway/hm.nix +++ b/modules/sway/hm.nix @@ -55,6 +55,10 @@ in { }; output."*".bg = "${config.stylix.image} fill"; + + seat."*" = { + xcursor_theme = "${config.stylix.cursor.name} ${toString config.stylix.cursor.size}"; + }; }; }) diff --git a/stylix/cursor.nix b/stylix/cursor.nix new file mode 100644 index 00000000..c746e0f1 --- /dev/null +++ b/stylix/cursor.nix @@ -0,0 +1,26 @@ +{ pkgs, config, lib, ... } @ args: + +with lib; + +let + cfg = config.stylix.cursor; + fromOs = import ./fromos.nix { inherit lib args; }; +in { + options.stylix.cursor = { + name = mkOption { + description = mdDoc "The cursor name within the package."; + type = types.str; + default = fromOs [ "cursor" "name" ] "Vanilla-DMZ"; + }; + package = mkOption { + description = mdDoc "Package providing the cursor theme."; + type = types.package; + default = fromOs [ "cursor" "package" ] pkgs.vanilla-dmz; + }; + size = mkOption { + description = mdDoc "The cursor size."; + type = types.int; + default = fromOs [ "cursor" "size" ] 32; + }; + }; +} diff --git a/stylix/hm/cursor.nix b/stylix/hm/cursor.nix new file mode 100644 index 00000000..4694482e --- /dev/null +++ b/stylix/hm/cursor.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.stylix.cursor; + +in { + imports = [ ../cursor.nix ]; + + config = mkIf ((builtins.match ".*-linux" "${pkgs.system}") != null) { + home.pointerCursor = { + name = "${cfg.name}"; + package = cfg.package; + size = cfg.size; + x11 = { + enable = true; + defaultCursor = "${cfg.name}"; + }; + gtk.enable = true; + }; + }; +} diff --git a/stylix/hm/default.nix b/stylix/hm/default.nix index 4759035c..c27dec24 100644 --- a/stylix/hm/default.nix +++ b/stylix/hm/default.nix @@ -9,6 +9,7 @@ in { ../pixel.nix ../target.nix ../opacity.nix + ./cursor.nix ./fonts.nix (import ./palette.nix { inherit palette-generator base16; }) (import ../templates.nix inputs) diff --git a/stylix/nixos/cursor.nix b/stylix/nixos/cursor.nix new file mode 100644 index 00000000..a884685b --- /dev/null +++ b/stylix/nixos/cursor.nix @@ -0,0 +1,10 @@ +{ config, ... }: + +let + cfg = config.stylix.cursor; +in { + imports = [ ../cursor.nix ]; + config = { + environment.variables.XCURSOR_SIZE = "${toString cfg.size}"; + }; +} diff --git a/stylix/nixos/default.nix b/stylix/nixos/default.nix index 50a0308d..6317b8ac 100644 --- a/stylix/nixos/default.nix +++ b/stylix/nixos/default.nix @@ -10,6 +10,7 @@ in { ../pixel.nix ../target.nix ../opacity.nix + ./cursor.nix ./fonts.nix (import ./palette.nix { inherit palette-generator base16; }) (import ../templates.nix inputs)