From 512306ae5848d11a9b38afe4680b69e4908648a2 Mon Sep 17 00:00:00 2001 From: Weathercold Date: Wed, 7 Aug 2024 09:02:01 +0800 Subject: [PATCH] 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 --- modules/home-manager/hyprland.nix | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix index da82d9e..69e1de2 100644 --- a/modules/home-manager/hyprland.nix +++ b/modules/home-manager/hyprland.nix @@ -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"; }; }; }