From 900cb6b8e84b1821a90929f96c62138e02db3ddf Mon Sep 17 00:00:00 2001 From: alexion Date: Wed, 22 Jul 2026 17:15:32 -0400 Subject: [PATCH] feat(desktop): add mako notifications (task 0025) Add a mako notification daemon module to the desktop group, enabled by the aggregator. Toasts auto-dismiss into history after five seconds, a do-not-disturb mode ([mode=dnd] invisible=true) suppresses display while still recording to history, and Super+N recalls the last notification via makoctl restore. Colors and the popup font come from Stylix's mako target. The bar-side do-not-disturb toggle and media controls already live in waybar.nix, so this task adds only the daemon. --- .claude/tasks/0025-mako-notifications.md | 32 ++++++++++++++--- modules/desktop/desktop.nix | 1 + modules/desktop/mako.nix | 44 ++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 modules/desktop/mako.nix diff --git a/.claude/tasks/0025-mako-notifications.md b/.claude/tasks/0025-mako-notifications.md index 4a3acff..dc44047 100644 --- a/.claude/tasks/0025-mako-notifications.md +++ b/.claude/tasks/0025-mako-notifications.md @@ -12,7 +12,31 @@ The do-not-disturb toggle and media controls live in the bar, not in a separate ## Acceptance criteria -- [ ] A mako module exists in the desktop group and is enabled by the aggregator. -- [ ] Notification toasts appear, with do-not-disturb and history recall. -- [ ] No separate slide-out notification-center panel is added. -- [ ] neogaia builds green under `nix flake check`. +- [x] A mako module exists in the desktop group and is enabled by the aggregator. +- [x] Notification toasts appear, with do-not-disturb and history recall. +- [x] No separate slide-out notification-center panel is added. +- [x] neogaia builds green under `nix flake check`. + +## Implementation Notes + +- **Bar side already in place.** + The do-not-disturb toggle (`custom/dnd`, calling `makoctl mode -t dnd`) and the MPRIS media controls already live in `modules/desktop/waybar.nix` from task 0024. + This task therefore adds only the daemon: `modules/desktop/mako.nix` enables `services.mako` through home-manager and is turned on by the aggregator. + The mode name is `dnd` on both sides, so the bar's toggle and the daemon's `[mode=dnd]` section agree. + +- **Colors from Stylix.** + Stylix ships a mako target that drives the background, border, text, and progress colors plus the popup font from the one Nord base16 scheme, so the module sets no colors — only behaviour. + This mirrors how `rofi.nix` and `theming.nix` defer their palettes to Stylix. + +- **Do-not-disturb keeps history.** + The `[mode=dnd]` section sets `invisible=true`, which hides toasts while still recording them, so notifications missed during do-not-disturb remain retrievable. + +- **History recall keybind.** + `Super+N` runs `makoctl restore`, popping the last notification back from history keyboard-only, consistent with the rest of the session. + `N` is unused by the spec keybind table, and task 0021 established that each later task adds its own binding rather than 0021 binding to a then-missing tool. + +- **No Waybar icon mapping.** + The window-rewrite convention covers graphical apps whose windows appear on the workspace indicator; mako renders toasts as a layer-shell overlay with no tiled window and no `hyprctl clients` entry, so there is nothing to match on. + +- **Dropped from the plan.** + A `Super+Shift+N` dismiss-all binding was drafted alongside the recall bind but removed as unrequested scope: the acceptance criteria call for history recall, which `restore` alone serves. diff --git a/modules/desktop/desktop.nix b/modules/desktop/desktop.nix index aa6b80d..6e945b8 100644 --- a/modules/desktop/desktop.nix +++ b/modules/desktop/desktop.nix @@ -11,6 +11,7 @@ in config = lib.mkIf cfg.enable { modules.desktop.hyprland.enable = lib.mkDefault true; modules.desktop.login.enable = lib.mkDefault true; + modules.desktop.mako.enable = lib.mkDefault true; modules.desktop.rofi.enable = lib.mkDefault true; modules.desktop.terminal.enable = lib.mkDefault true; modules.desktop.theming.enable = lib.mkDefault true; diff --git a/modules/desktop/mako.nix b/modules/desktop/mako.nix new file mode 100644 index 0000000..cf0d90a --- /dev/null +++ b/modules/desktop/mako.nix @@ -0,0 +1,44 @@ +{ + config, + lib, + pkgs, + ... +}: +# mako as the notification daemon: toasts, a do-not-disturb mode, and history recall. +let + cfg = config.modules.desktop.mako; + user = config.user.name; + + makoctl = "${pkgs.mako}/bin/makoctl"; +in +{ + options.modules.desktop.mako.enable = lib.mkEnableOption "the mako notification daemon"; + + config = lib.mkIf cfg.enable { + home-manager.users.${user} = { + # Colors and the popup font come from Stylix's mako target, so only + # behaviour is set here. + services.mako = { + enable = true; + + settings = { + # Toasts auto-dismiss into history rather than lingering. + # mako's own default of 0 leaves every notification on screen until acted on. + default-timeout = 5000; + + # The do-not-disturb mode. + # Invisible hides the toasts but still records them to history. + # Missed notifications can therefore be recalled. + "mode=dnd".invisible = true; + }; + }; + + # Recall the last notification from history, keyboard-only like the rest + # of the session. + # $mod is defined by the compositor config these binds share. + wayland.windowManager.hyprland.settings.bind = [ + "$mod, N, exec, ${makoctl} restore" + ]; + }; + }; +} -- 2.47.3