From a2f9247f5d636fa0939666f56638cee15e6c79fb Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sat, 16 Nov 2024 21:26:35 -0800 Subject: [PATCH] feat(home): Dunst --- homes/x86_64-linux/marley@nyx/default.nix | 2 + modules/home/services/dunst/default.nix | 122 ++++++++++++++++++++++ old/home/services/dunst.nix | 103 ------------------ 3 files changed, 124 insertions(+), 103 deletions(-) create mode 100644 modules/home/services/dunst/default.nix delete mode 100644 old/home/services/dunst.nix diff --git a/homes/x86_64-linux/marley@nyx/default.nix b/homes/x86_64-linux/marley@nyx/default.nix index d052056..c548cb2 100644 --- a/homes/x86_64-linux/marley@nyx/default.nix +++ b/homes/x86_64-linux/marley@nyx/default.nix @@ -52,6 +52,8 @@ in }; services = { clipboard = enabled; + # TODO: bundle this with the WM under xorg + dunst = enabled; }; xorg = { xsession = enabled; diff --git a/modules/home/services/dunst/default.nix b/modules/home/services/dunst/default.nix new file mode 100644 index 0000000..0213bad --- /dev/null +++ b/modules/home/services/dunst/default.nix @@ -0,0 +1,122 @@ +{ + lib, + config, + namespace, + ... +}: +let + inherit (lib) + mkIf + enabled + disabled + mkMerge + ; + inherit (lib.${namespace}) mkEnableModule; + + cfg = config.${namespace}.services.dunst; + inherit (config.${namespace}) theme; + + isRosePine = theme.colors.base == "rose-pine"; +in +{ + options = mkEnableModule "services.dunst"; + + config = mkIf cfg.enable { + services.dunst = { + enable = true; + + # I don't want to use the rose-pine icons; also don't want to deal with + # the drop-in weirdness. + # TODO: Convert dunst.rose-pine to attr set to fix this. + "${theme.colors.base}" = if isRosePine then disabled else enabled; + + settings = mkMerge [ + ### Rose Pine ### + (mkIf isRosePine { + global = { + width = 400; + offset = "20x60"; + progress_bar_min_width = 380; + progress_bar_max_width = 380; + progress_bar_corner_radius = 2; + padding = 10; + horizontal_padding = 10; + frame_width = 1; + gap_size = 3; + corner_radius = 2; + background = "#26233a"; + foreground = "#e0def4"; + }; + + urgency_low = { + background = "#26273d"; + highlight = "#31748f"; + frame_color = "#31748f"; + default_icon = "dialog-information"; + format = "%s\\n%b"; + }; + + urgency_normal = { + background = "#362e3c"; + highlight = "#f6c177"; + frame_color = "#f6c177"; + default_icon = "dialog-warning"; + format = "%s\\n%b"; + }; + + urgency_critical = { + background = "#35263d"; + highlight = "#eb6f92"; + frame_color = "#eb6f92"; + default_icon = "dialog-error"; + format = "%s\\n%b"; + }; + }) + + ### Custom ### + { + global = { + monitor = 0; + sort = "yes"; + idle_threshold = 120; + font = (builtins.head config.fonts.fontconfig.defaultFonts.monospace) + " 10"; + markup = "full"; + show_age_threshold = 60; + word_wrap = "yes"; + ignore_newline = "no"; + stack_duplicates = true; + hide_duplicate_count = false; + show_indicators = "yes"; + sticky_history = "yes"; + history_length = 20; + browser = "/usr/bin/zen-browser --new-tab"; + always_run_script = true; + title = "Dunst"; + class = "Dunst"; + mouse_left_click = "do_action"; + mouse_middle_click = "close_current"; + mouse_right_click = "close_all"; + }; + + signed_on = { + appname = "Pidgin"; + summary = "*signed on*"; + urgency = "low"; + }; + + signed_off = { + appname = "Pidgin"; + summary = "*signed off*"; + urgency = "low"; + }; + + says = { + appname = "Pidgin"; + summary = "*says*"; + urgency = "critical"; + }; + } + ]; + }; + }; +} diff --git a/old/home/services/dunst.nix b/old/home/services/dunst.nix deleted file mode 100644 index 9bf3f89..0000000 --- a/old/home/services/dunst.nix +++ /dev/null @@ -1,103 +0,0 @@ -{ - config, - lib, - ... -}: -{ - services.dunst = { - enable = true; - - # I don't want to use the rose-pine icons; also don't want to deal with the - # drop-in weirdness. - rose-pine.enable = false; - - settings = lib.mkMerge [ - ### Rose Pine ### - # TODO: Set this conditionally based on current theme. - { - global = { - width = 400; - offset = "20x60"; - progress_bar_min_width = 380; - progress_bar_max_width = 380; - progress_bar_corner_radius = 2; - padding = 10; - horizontal_padding = 10; - frame_width = 1; - gap_size = 3; - corner_radius = 2; - background = "#26233a"; - foreground = "#e0def4"; - }; - - urgency_low = { - background = "#26273d"; - highlight = "#31748f"; - frame_color = "#31748f"; - default_icon = "dialog-information"; - format = "%s\\n%b"; - }; - - urgency_normal = { - background = "#362e3c"; - highlight = "#f6c177"; - frame_color = "#f6c177"; - default_icon = "dialog-warning"; - format = "%s\\n%b"; - }; - - urgency_critical = { - background = "#35263d"; - highlight = "#eb6f92"; - frame_color = "#eb6f92"; - default_icon = "dialog-error"; - format = "%s\\n%b"; - }; - } - - ### Custom ### - { - global = { - monitor = 0; - sort = "yes"; - idle_threshold = 120; - font = (builtins.head config.fonts.fontconfig.defaultFonts.monospace) + " 10"; - markup = "full"; - show_age_threshold = 60; - word_wrap = "yes"; - ignore_newline = "no"; - stack_duplicates = true; - hide_duplicate_count = false; - show_indicators = "yes"; - sticky_history = "yes"; - history_length = 20; - browser = "/usr/bin/zen-browser --new-tab"; - always_run_script = true; - title = "Dunst"; - class = "Dunst"; - mouse_left_click = "do_action"; - mouse_middle_click = "close_current"; - mouse_right_click = "close_all"; - }; - - signed_on = { - appname = "Pidgin"; - summary = "*signed on*"; - urgency = "low"; - }; - - signed_off = { - appname = "Pidgin"; - summary = "*signed off*"; - urgency = "low"; - }; - - says = { - appname = "Pidgin"; - summary = "*says*"; - urgency = "critical"; - }; - } - ]; - }; -}