From db4860d28310d378b1ca944a399ee61ae5e733ba Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sat, 19 Oct 2024 19:37:03 -0700 Subject: [PATCH] feat(dunst): Catppuccin -> Rose Pine --- .sources/sources.json | 12 +++++++++ modules/home-manager/dunst.nix | 48 ++++++++++++++++++++-------------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/.sources/sources.json b/.sources/sources.json index 6ffaea9..2f3abf0 100644 --- a/.sources/sources.json +++ b/.sources/sources.json @@ -360,6 +360,18 @@ "url": "https://github.com/catppuccin/rofi/archive/b636a00fd40a7899a8206195464ae8b7f0450a6d.tar.gz", "hash": "1a1sr451nsfii70j2f5qf8wq4jns0d4477a2kzh3993xdnx1j3yc" }, + "rose-pine-dunst": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "d2718nis", + "repo": "rose-pine-dunst" + }, + "branch": "main", + "revision": "496499eaed38a07ce4f79ec91baaf6e1e4c28bc5", + "url": "https://github.com/d2718nis/rose-pine-dunst/archive/496499eaed38a07ce4f79ec91baaf6e1e4c28bc5.tar.gz", + "hash": "0x7cqbcn7zygab9xbmbarz06wxkj3wxxffwmka33ljhm8gk3x0ay" + }, "skim": { "type": "Git", "repository": { diff --git a/modules/home-manager/dunst.nix b/modules/home-manager/dunst.nix index 07a5dfc..3cb3ab2 100644 --- a/modules/home-manager/dunst.nix +++ b/modules/home-manager/dunst.nix @@ -1,26 +1,34 @@ -{ config, lib, ... }: -let - inherit (config.catppuccin) sources; - cfg = config.services.dunst.catppuccin; - enable = cfg.enable && config.services.dunst.enable; -in { - options.services.dunst.catppuccin = lib.ctp.mkCatppuccinOpt { name = "dunst"; } // { - prefix = lib.mkOption { - type = lib.types.str; - default = "00"; - description = "Prefix to use for the dunst drop-in file"; + config, + lib, + ... +}: let + inherit (config.rose-pine) sources; + cfg = config.services.dunst.rose-pine; + enable = cfg.enable && config.services.dunst.enable; + themeName = + if (cfg.flavor == "main") + then "rose-pine" + else "rose-pine-${cfg.flavor}"; +in { + options.services.dunst.rose-pine = + lib.rp.mkRosePineOpt {name = "dunst";} + // { + prefix = lib.mkOption { + type = lib.types.str; + default = "00"; + description = "Prefix to use for the dunst drop-in file"; + }; }; - }; - # Dunst currently has no "include" functionality, but has "drop-ins" - # Unfortunately, this may cause inconvenience as it overrides ~/.config/dunst/dunstrc - # but it can be overridden by another drop-in. + # Dunst currently has no "include" functionality, but has "drop-ins". + # Unfortunately, this may cause inconvenience as it overrides + # ~/.config/dunst/dunstrc but it can be overridden by another drop-in. config.xdg.configFile = lib.mkIf enable { - # Using a prefix like this is necessary because drop-ins' precedence depends on lexical order - # such that later drop-ins override earlier ones - # This way, users have better control over precedence - "dunst/dunstrc.d/${cfg.prefix}-catppuccin.conf".source = - sources.dunst + "/themes/${cfg.flavor}.conf"; + # Using a prefix like this is necessary because drop-ins' precedence depends + # on lexical order such that later drop-ins override earlier ones. + # This way, users have better control over precedence. + "dunst/dunstrc.d/${cfg.prefix}-rose-pine.conf".source = + sources.dunst + "/${themeName}.conf"; }; }