feat: Sway keymap for notification response #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Notification Dispatch
Overview
$mod+nresponds to the most recent visible notification. A dispatch system matches notification properties against a set of named handlers and executes the first match. Unmatched notifications fall back to default mako invocation.Keybind
$mod+ninmodules/sway/src/keymaps.conf, invoking a dispatch script.Dispatch system
Notification target
The dispatch system always acts on the most recent notification, consistent with how
makoctl dismissbehaves without an explicit-nflag.Matching model
Each handler declares one or more field conditions. All conditions must match exactly for the handler to fire (AND semantics). Matchable fields are those exposed by
makoctl list -j:app_namesummarybodyurgencyDismissal
On handler success, the notification is dismissed.
On fallback (no matching handler), the notification is dismissed regardless of whether it had invokable actions.
On handler failure (see per-handler failure modes), the notification is left visible.
Fallback
When no handler matches, the dispatch script calls
makoctl invokethen dismisses.Notification listener
Purpose
Handler logic that needs to identify the originating window of a notification must resolve the D-Bus sender PID at notification arrival time. The listener intercepts
org.freedesktop.Notifications.Notifycalls on the session bus, resolves each sender's connection name to a PID viaorg.freedesktop.DBus.GetConnectionUnixProcessID, and writes the mappingnotification_id → sender_pidto a state file.Lifecycle
Started via
execin the sway config. Scoped to the sway session.State file
A temporary file updated by the listener. Read by handlers that require originating-window resolution.
Handlers
Claude Code
Match
summaryClaude CodeAction
Switch to the terminal window that originated the notification.
Window identification:
Failure mode
If the originating window cannot be found (process gone, window closed), the handler exits silently. The notification is left visible.