From bc6ad113ad2d47ec82ff15dd6bed9b08887dd580 Mon Sep 17 00:00:00 2001 From: Joshua Yuen Date: Sat, 12 Sep 2026 20:15:33 -0400 Subject: [PATCH] Show friendly app names and make dictation notifications toast-only --- modules/home/ags/app/widget/Notifications.tsx | 48 ++++++++++++++++--- modules/home/dictation.nix | 4 +- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/modules/home/ags/app/widget/Notifications.tsx b/modules/home/ags/app/widget/Notifications.tsx index 1324eb8..fa42706 100644 --- a/modules/home/ags/app/widget/Notifications.tsx +++ b/modules/home/ags/app/widget/Notifications.tsx @@ -14,11 +14,43 @@ export const dndIcon = Variable.derive([bind(notifd, "dontDisturb")], (dnd) => // every notification received this session is kept until it is explicitly // cleared, so popups that time out remain in the dropdown's list. only -// notifications dismissed directly from their popup skip the list. +// notifications dismissed directly from their popup skip the list, and +// transient status toasts never enter it at all. export const history = Variable([]) export const notifCount = bind(history).as((ns) => ns.length) +// apps whose notifications are transient status updates: they surface as +// toasts only and never enter the dropdown history or the bar count +const EPHEMERAL_APPS = new Set(["dictation"]) + +// irregular ids the generic capitalization rule can't fix up +const FRIENDLY_NAMES: Record = { + "notify-send": "Notification", +} + +// per-app icons for notifications that don't supply one +const APP_ICONS: Record = { + dictation: "audio-input-microphone-symbolic", +} + +// apps like discord report a bare binary id; make words of those while +// names with any uppercase ("Spotify") pass through untouched +function displayName(n: Notifd.Notification) { + const raw = n.app_name || "Notification" + + const mapped = FRIENDLY_NAMES[raw.toLowerCase()] + if (mapped) return mapped + + if (raw === raw.toLowerCase() && /[a-z]/.test(raw)) { + return raw + .split(/[-_ ]+/) + .map((w) => w.charAt(0).toUpperCase() + w.slice(1)) + .join(" ") + } + return raw +} + export function DndToggle() { return (