Add cursor support (#172)

Co-authored-by: Daniel Thwaites <danthwaites30@btinternet.com>
This commit is contained in:
sntx 2023-11-01 10:40:25 -03:00 committed by GitHub
parent 4380955949
commit 07795247c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 64 additions and 0 deletions

View file

@ -55,6 +55,10 @@ in {
};
output."*".bg = "${config.stylix.image} fill";
seat."*" = {
xcursor_theme = "${config.stylix.cursor.name} ${toString config.stylix.cursor.size}";
};
};
})

26
stylix/cursor.nix Normal file
View file

@ -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;
};
};
}

22
stylix/hm/cursor.nix Normal file
View file

@ -0,0 +1,22 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.stylix.cursor;
in {
imports = [ ../cursor.nix ];
config = mkIf pkgs.stdenv.hostPlatform.isLinux {
home.pointerCursor = {
name = cfg.name;
package = cfg.package;
size = cfg.size;
x11 = {
enable = true;
defaultCursor = cfg.name;
};
gtk.enable = true;
};
};
}

View file

@ -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)

10
stylix/nixos/cursor.nix Normal file
View file

@ -0,0 +1,10 @@
{ config, ... }:
let
cfg = config.stylix.cursor;
in {
imports = [ ../cursor.nix ];
config = {
environment.variables.XCURSOR_SIZE = toString cfg.size;
};
}

View file

@ -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)