Skip to content

Commit

Permalink
feat: added cursor support and theming to stylix
Browse files Browse the repository at this point in the history
  • Loading branch information
sntx committed Oct 16, 2023
1 parent feceaa9 commit 87325e6
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/sway/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ in {
};

output."*".bg = "${config.stylix.image} fill";

seat."*" = {
xcursor_theme = "${config.stylix.cursor.name} ${toString config.stylix.cursor.size}";
};
};
})

Expand Down
26 changes: 26 additions & 0 deletions stylix/cursor.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 22 additions & 0 deletions stylix/hm/cursor.nix
Original file line number Diff line number Diff line change
@@ -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;
};
};
}
1 change: 1 addition & 0 deletions stylix/hm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions stylix/nixos/cursor.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ config, ... }:

let
cfg = config.stylix.cursor;
in {
imports = [ ../cursor.nix ];
config = {
environment.variables.XCURSOR_SIZE = "${toString cfg.size}";
};
}
1 change: 1 addition & 0 deletions stylix/nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 87325e6

Please sign in to comment.