fix(home-manager/hyprland): inherit cursor size, unset hyprcursor env vars (#299)

* fix(home-manager): make hyprcursor inherit size

* fix(home-manager): unset hyprcursor env vars in hyprland config

They're already set in `home.sessionVariables`.
Note that you need to launch hyprland from a login
shell in order for the variables to be set, but
I doubt that hyprcursor was being used prior to
this commit since `MyCursor` is invalid

* refactor(home-manager): set `accent(Alpha)` through hyprland nix config

Why not use nix config when it exists
This commit is contained in:
Weathercold 2024-08-07 09:02:01 +08:00 committed by GitHub
parent 19a0f144f0
commit 512306ae58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,9 +1,8 @@
{ config, lib, ... }:
let
inherit (config.catppuccin) sources;
inherit (config.catppuccin) sources pointerCursor;
cfg = config.wayland.windowManager.hyprland.catppuccin;
enable = cfg.enable && config.wayland.windowManager.hyprland.enable;
inherit (config.catppuccin) pointerCursor;
in
{
options.wayland.windowManager.hyprland.catppuccin =
@ -14,25 +13,14 @@ in
config = lib.mkIf enable {
home.sessionVariables = lib.mkIf pointerCursor.enable {
HYPRCURSOR_SIZE = "24";
HYPRCURSOR_SIZE = config.home.pointerCursor.size;
HYPRCURSOR_THEME = "catppuccin-${pointerCursor.flavor}-${pointerCursor.accent}-cursors";
};
wayland.windowManager.hyprland.settings = {
source =
[
"${sources.hyprland}/themes/${cfg.flavor}.conf"
(builtins.toFile "hyprland-${cfg.accent}-accent.conf" ''
$accent=''$${cfg.accent}
$accentAlpha=''$${cfg.accent}Alpha
'')
]
++ lib.optionals pointerCursor.enable [
(builtins.toFile "hyprland-cursors.conf" ''
env = HYPRCURSOR_THEME,MyCursor
env = HYPRCURSOR_SIZE,24
'')
];
source = "${sources.hyprland}/themes/${cfg.flavor}.conf";
"$accent" = "\$${cfg.accent}";
"$accentAlpha" = "\$${cfg.accent}Alpha";
};
};
}