Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(notify): surface macOS permission denial + Open System Settings repair path

enes87234500fad1
diff --git a/src/main/index.ts b/src/main/index.ts
index cfaab9fb8..598ef54dd 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -275,14 +275,17 @@ app.whenReady().then(async () => {
// Show an OS notification — but only when the window is in the background. Clicking it
// brings the app forward and asks the renderer to focus the originating node.
+ // Resolves 'shown' | 'failed' | 'skipped' so the renderer can SEE a macOS permission
+ // denial (UNErrorCodeNotificationsNotAllowed) instead of it dying silently — that broke
+ // once already after an Electron upgrade invalidated the ncprefs signature record.
ipcMain.handle(
IPC.appNotify,
- (_e, payload: { title: string; body: string; nodeId: string; force?: boolean }) => {
+ async (_e, payload: { title: string; body: string; nodeId: string; force?: boolean }) => {
const win = getMainWindow()
- if (!win || !Notification.isSupported()) return false
+ if (!win || !Notification.isSupported()) return 'skipped'
// `force` (permission request / confirmation) shows even when focused; normal
// completion notifications only show when the window is in the background.
- if (!payload.force && win.isFocused()) return false
+ if (!payload.force && win.isFocused()) return 'skipped'
const n = new Notification({ title: payload.title, body: payload.body })
n.on('click', () => {
// Re-resolve at click time — the window may have been hidden/recreated since.
@@ -296,11 +299,33 @@ app.whenReady().then(async () => {
// Without a retained reference the wrapper gets GC'd and the click handler dies —
// clicking would then only activate the app, never focus the originating node.
retainUntilDismissed(n)
- n.show()
- return true
+ return await new Promise<'shown' | 'failed'>((resolve) => {
+ // macOS reports delivery async; if neither event lands quickly, assume shown
+ // (Windows/Linux never emit 'failed').
+ const timer = setTimeout(() => resolve('shown'), 1500)
+ n.on('show', () => {
+ clearTimeout(timer)
+ resolve('shown')
+ })
+ n.on('failed', (_ev, error) => {
+ clearTimeout(timer)
+ console.warn('[notify] OS rejected the notification:', error)
+ resolve('failed')
+ })
+ n.show()
+ })
}
)
+ // Deep-link to the OS notification settings so the user can re-grant a denied
+ // permission (macOS never re-prompts once the app's record exists). The URL is a
+ // main-side constant — deliberately NOT routed through shellOpenExternal's
+ // http(s)-only allowlist, which must stay closed to renderer-supplied strings.
+ ipcMain.handle(IPC.appOpenNotificationSettings, () => {
+ if (process.platform !== 'darwin') return
+ void shell.openExternal('x-apple.systempreferences:com.apple.Notifications-Settings.extension')
+ })
+
ipcMain.handle(IPC.announcementsFetch, async () => (await fetchCheck()).messages)
ipcMain.handle(IPC.appUpdatePolicy, async () => (await fetchCheck()).update)
diff --git a/src/preload/index.ts b/src/preload/index.ts
index 247b3493e..508bf40fe 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -340,6 +340,7 @@ const api: NodeTerminalApi = {
getPathForFile: (file: File) => webUtils.getPathForFile(file),
userDataDir: () => ipcRenderer.invoke(IPC.appUserDataDir),
notify: (payload) => ipcRenderer.invoke(IPC.appNotify, payload),
+ openNotificationSettings: () => ipcRenderer.invoke(IPC.appOpenNotificationSettings),
onFocusNode: (listener) => {
const handler = (_e: unknown, nodeId: string) => listener(nodeId)
ipcRenderer.on(IPC.appFocusNode, handler)
diff --git a/src/renderer/components/settings/sections/NotificationsSection.tsx b/src/renderer/components/settings/sections/NotificationsSection.tsx
index 837222b9c..8c5d7c655 100644
--- a/src/renderer/components/settings/sections/NotificationsSection.tsx
+++ b/src/renderer/components/settings/sections/NotificationsSection.tsx
@@ -1,8 +1,10 @@
+import { useState } from 'react'
import { useSettings } from '../../../state/settings'
import { SettingsSection } from '../SettingsSection'
import { SearchableRow } from '../SearchableRow'
import { FieldRow } from '../FieldRow'
import { Switch } from '@renderer/ui/Switch'
+import { Button } from '@renderer/ui/Button'
const ROWS = {
notify: {
@@ -15,6 +17,9 @@ const ENTRIES = Object.values(ROWS)
export function NotificationsSection({ isActive }: { isActive: boolean }): React.JSX.Element {
const notifyOnClaudeDone = useSettings((s) => s.settings.notifyOnClaudeDone)
const update = useSettings((s) => s.update)
+ // The OS refused our test notification (macOS permission denied). macOS never re-prompts
+ // once the app's record exists, so the only way back is the System Settings pane.
+ const [osBlocked, setOsBlocked] = useState(false)
return (
<SettingsSection
id="notifications"
@@ -32,18 +37,31 @@ export function NotificationsSection({ isActive }: { isActive: boolean }): React
ariaLabel="Background notifications"
onChange={(on) => {
update({ notifyOnClaudeDone: on, notifyConsentAsked: true })
- // Enabling triggers the macOS notification permission prompt.
+ setOsBlocked(false)
+ // Enabling fires a real test notification: on a fresh install this is what
+ // triggers the macOS permission prompt; on a denied/stale record the OS
+ // rejects it and we surface the repair path below.
if (on)
- void window.nodeTerminal.notify({
- title: 'Notifications enabled',
- body: "You'll be told when Claude Code finishes in the background.",
- nodeId: '',
- force: true
- })
+ void window.nodeTerminal
+ .notify({
+ title: 'Notifications enabled',
+ body: "You'll be told when Claude Code finishes in the background.",
+ nodeId: '',
+ force: true
+ })
+ .then((result) => setOsBlocked(result === 'failed'))
}}
/>
}
/>
+ {osBlocked && (
+ <div className="mt-2 flex items-center gap-3 text-[13px] text-[#ffd60a]">
+ macOS is blocking notifications for this app.
+ <Button onClick={() => void window.nodeTerminal.openNotificationSettings()}>
+ Open System Settings
+ </Button>
+ </div>
+ )}
</SearchableRow>
</SettingsSection>
)
diff --git a/src/shared/ipc.ts b/src/shared/ipc.ts
index dea6502b2..1f029bc7c 100644
--- a/src/shared/ipc.ts
+++ b/src/shared/ipc.ts
@@ -20,6 +20,7 @@ export const IPC = {
appCloseNode: 'app:close-node',
appCloseWindow: 'app:close-window',
appNotify: 'app:notify',
+ appOpenNotificationSettings: 'app:open-notification-settings',
appFocusNode: 'app:focus-node',
appSetBadge: 'app:set-badge',
agentStatus: 'agent:status',
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 90fe29a33..6bc66601c 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -876,8 +876,11 @@ export interface NodeTerminalApi {
getPathForFile(file: File): string
/** Absolute writable base dir (Electron userData) for app-managed files like default worktrees. */
userDataDir(): Promise<string>
- /** Show an OS notification (main suppresses it if the window is focused). Returns whether shown. */
- notify(payload: NotifyPayload): Promise<boolean>
+ /** Show an OS notification (main suppresses it if the window is focused). 'failed' =
+ * the OS rejected it (e.g. macOS permission denied) — surface it, don't ignore it. */
+ notify(payload: NotifyPayload): Promise<'shown' | 'failed' | 'skipped'>
+ /** Open the OS notification settings pane (macOS; no-op elsewhere) to re-grant permission. */
+ openNotificationSettings(): Promise<void>
/** Fires when a notification is clicked, asking the renderer to focus a node. Returns unsubscribe. */
onFocusNode(listener: (nodeId: string) => void): () => void
/** Fires on each normalized agent hook event (working/done/waiting/subagent/…). Returns unsubscribe. */