From a4096481a064329d702c78c200d3cb278fb0f85a Mon Sep 17 00:00:00 2001 From: 514fpv <koishi@514fpv.one> Date: Mon, 12 Feb 2024 17:40:58 +0800 Subject: [PATCH] feat(gui): add catppuccin gtk and cursor themes --- home/gnome/impl/home.nix | 17 ---------- home/gui/catppuccin/home.nix | 13 +++++++ home/gui/catppuccin/nixos.nix | 64 +++++++++++++++++++++++++++++++++++ home/gui/home.nix | 52 +++++++++++++++------------- home/gui/nixos.nix | 14 +++++--- 5 files changed, 115 insertions(+), 45 deletions(-) create mode 100644 home/gui/catppuccin/home.nix create mode 100644 home/gui/catppuccin/nixos.nix diff --git a/home/gnome/impl/home.nix b/home/gnome/impl/home.nix index 49d3112b..24d15901 100644 --- a/home/gnome/impl/home.nix +++ b/home/gnome/impl/home.nix @@ -4,23 +4,6 @@ , ... }: with lib; let cfg = config.passthrough.gnome; in mkIf cfg.enable { - # cursor theme - home.pointerCursor = { - package = pkgs.catppuccin-cursors.frappeDark; - name = "Catppuccin-Frappe-Dark-Cursors"; - }; - - # gtk theme - gtk.theme = { - package = pkgs.catppuccin-gtk.override { - accents = [ "pink" ]; - size = "compact"; - #tweaks = [ "rimless" "black" ]; - variant = "frappe"; - }; - name = "Catppuccin-Frappe-Compact-Pink-Dark"; - }; - home.packages = with pkgs; with gnome; diff --git a/home/gui/catppuccin/home.nix b/home/gui/catppuccin/home.nix new file mode 100644 index 00000000..84b27de6 --- /dev/null +++ b/home/gui/catppuccin/home.nix @@ -0,0 +1,13 @@ +{ pkgs +, lib +, config +, ... }: with lib; let + cfg = config.passthrough.catppuccin; +in mkIf cfg.enable { + # cursor theme + home.pointerCursor = { inherit (cfg.cursor) package name; }; + gtk.cursorTheme = { inherit (cfg.cursor) package name; }; + + # gtk theme + gtk.theme = { inherit (cfg.gtk) package name; }; +} diff --git a/home/gui/catppuccin/nixos.nix b/home/gui/catppuccin/nixos.nix new file mode 100644 index 00000000..6b22b3f7 --- /dev/null +++ b/home/gui/catppuccin/nixos.nix @@ -0,0 +1,64 @@ +{ pkgs +, lib +, config +, ... }: with lib; let + gui = with config.global.gpu; enable && session; + cfg = config.home.catppuccin; +in { + options.home.catppuccin = { + enable = mkEnableOption "catppuccin colour scheme" // { default = gui; }; + + gtk = { + package = mkOption { + type = with types; package; + default = pkgs.catppuccin-gtk.override { + accents = [ "pink" ]; + size = "compact"; + #tweaks = [ "rimless" "black" ]; + variant = "frappe"; + }; + description = "catppuccin gtk theme package"; + }; + name = mkOption { + type = with types; str; + default = "Catppuccin-Frappe-Compact-Pink-Dark"; + description = "name of catppuccin gtk theme"; + }; + }; + + cursor = { + package = mkOption { + type = with types; package; + default = pkgs.catppuccin-cursors.frappeDark; + description = "catppuccin cursor theme package"; + }; + name = mkOption { + type = with types; str; + default = "Catppuccin-Frappe-Dark-Cursors"; + description = "name of catppuccin cursor theme"; + }; + }; + }; + + config = { + users.homeModules = [ + # this module passes catppuccin configuration to home-manager + { passthrough.catppuccin = cfg; } + ]; + + # gtk and cursor themes + environment.systemPackages = with cfg; mkIf cfg.enable [ + gtk.package cursor.package + ]; + + # override greetd theme + programs.regreet = mkIf cfg.enable { + settings = { + GTK = { + cursor_theme_name = cfg.cursor.name; + theme_name = cfg.gtk.name; + }; + }; + }; + }; +} diff --git a/home/gui/home.nix b/home/gui/home.nix index db833554..5168a78c 100644 --- a/home/gui/home.nix +++ b/home/gui/home.nix @@ -1,29 +1,33 @@ { pkgs , lib , config -, ... }: with lib; mkIf config.passthrough.gui { - # cursor theme - home.pointerCursor = { - package = mkDefault pkgs.bibata-cursors; - name = mkDefault "Bibata-Modern-Classic"; - size = 24; +, ... }: with lib; { + imports = [ ./catppuccin/home.nix ]; + + config = mkIf config.passthrough.gui { + # cursor theme + home.pointerCursor = { + package = mkDefault pkgs.bibata-cursors; + name = mkDefault "Bibata-Modern-Classic"; + size = 24; + }; + + # gtk theme + gtk.theme = { + package = mkDefault pkgs.whitesur-gtk-theme; + name = mkDefault "WhiteSur-Dark"; + }; + + # gtk icons + gtk.iconTheme = { + package = mkDefault pkgs.papirus-icon-theme; + name = mkDefault "Papirus-Dark"; + }; + + # unify qt theme + qt.platformTheme = mkDefault "gtk"; + + gtk.enable = mkDefault true; + qt.enable = mkDefault true; }; - - # gtk theme - gtk.theme = { - package = mkDefault pkgs.whitesur-gtk-theme; - name = mkDefault "WhiteSur-Dark"; - }; - - # gtk icons - gtk.iconTheme = { - package = mkDefault pkgs.papirus-icon-theme; - name = mkDefault "Papirus-Dark"; - }; - - # unify qt theme - qt.platformTheme = mkDefault "gtk"; - - gtk.enable = mkDefault true; - qt.enable = mkDefault true; } diff --git a/home/gui/nixos.nix b/home/gui/nixos.nix index abde0634..82012777 100644 --- a/home/gui/nixos.nix +++ b/home/gui/nixos.nix @@ -3,7 +3,10 @@ , config , ... }: with lib; let gui = with config.global.gpu; enable && session; + catppuccin = config.home.catppuccin; in { + imports = [ ./catppuccin/nixos.nix ]; + config = { users.homeModules = [ # this module passes gui configuration to home-manager @@ -12,10 +15,13 @@ in { users.adminGroups = mkIf gui [ "video" ]; # themes and icons - environment.systemPackages = with pkgs; mkIf gui [ - whitesur-gtk-theme whitesur-icon-theme - papirus-icon-theme bibata-cursors - ]; + environment.systemPackages = with pkgs; mkIf gui ([ + papirus-icon-theme + ] ++ optionals (!catppuccin.enable) [ + whitesur-gtk-theme + whitesur-icon-theme + bibata-cursors + ]); fonts.enableDefaultPackages = mkIf gui true;