Skip to content

fix: ask for macOS notification permission when the collector starts - #58

Merged
vishr merged 1 commit into
mainfrom
fix/notify-permission
Oct 24, 2026
Merged

vishr merged 1 commit into
mainfrom
fix/notify-permission

Conversation

@vishr

@vishr vishr commented Oct 24, 2026

Copy link
Copy Markdown
Member

Why notifications never worked on the maintainer's Mac

macOS asks each app for notification permission once. Driga asked lazily at the first alert. On 2026-10-23 the prompt appeared at 22:15, sat unanswered, and was withdrawn when the collector restarted at 23:22. macOS then stored Driga as asked and not allowed (same record as an explicit Don't Allow) and refused every later request immediately (UNErrorDomain 1), with no new prompt.

Verified with throwaway probe apps: a bundle launched directly by a launchd agent (as the collector is) gets the prompt and is granted on Allow, so the launch method is not the problem. The stored record for run.driga matched a declined probe bit for bit. After turning on Allow notifications in System Settings, a real low-disk alert was delivered and presented.

Changes

  • The collector requests permission at startup (attention.RequestNotificationPermission), so the prompt appears right after driga service install or a restart. Once decided, macOS answers silently.
  • driga doctor prints open "x-apple.systempreferences:com.apple.Notifications-Settings.extension?id=run.driga" when notifications are off.
  • docs/usage.md explains the one-time prompt and that click to jump is macOS only (Linux notify-send and Windows plain toasts have no click action).

Tests

  • New TestMacRequestPermissionAsksOnceBeforeAnyAlert: one request at startup covers the first alert; a refusal is re-checked on the next alert.
  • just check, GOOS=windows go vet ./..., GOOS=linux go vet ./... pass.

https://claude.ai/code/session_01T2vtcW6ihn1ywy9vxUq9a4

macOS shows the notification prompt only once. Driga asked lazily at the
first alert, often while nobody was at the screen; a collector restart
before the prompt was answered withdrew it, and macOS then recorded Driga
as asked and not allowed, refusing every later request without a prompt.

The collector now asks at startup, right after `driga service install` or a
restart, when the user is likely present. macOS answers silently from the
saved setting once decided. When notifications are off, `driga doctor`
prints the command that opens Driga's page in System Settings, the only way
to turn them on after a refusal. Usage docs state that click to jump works on
macOS only.

Claude-Session: https://claude.ai/code/session_01T2vtcW6ihn1ywy9vxUq9a4
@vishr
vishr merged commit c170d41 into main Oct 24, 2026
4 checks passed
@vishr
vishr deleted the fix/notify-permission branch October 24, 2026 14:36
vishr added a commit that referenced this pull request Oct 24, 2026
The landing page leads with a 24-second film and three short loops, all
recordings of the shipped binary:

- cmd/driga-demo plays scripted sessions into a private data directory: it
  writes the store, holds the collector lock and runs the real prompt
  broker, so `driga` and `driga web` read it as a live collector. It never
  reads the process table, agent files or Git.
- site/footage records the TUI with VHS and the web dashboard (dark and
  light) with Playwright, then cuts site/public/media with Remotion.
  `just site-footage` redoes all of it.

The page follows the approved design: status line, headline, install,
film, feature sections for Needs you, Flow and Machines, three ways in,
local by default, and a closing install. The site switches to Geist and
Geist Mono, with Catppuccin state colours darkened to 4.5:1 in Latte.

Docs follow the CLI changes in #59: bare `driga` opens the viewer, and
activity, conflicts and --watch are gone. The notifications guide explains
the one-time macOS prompt from #58.

Claude-Session: https://claude.ai/code/session_01T2vtcW6ihn1ywy9vxUq9a4
vishr added a commit that referenced this pull request Oct 24, 2026
A Starlight site for driga.dev, built from the code where it can be:

- cmd/driga-docgen writes the CLI, settings, MCP tools and hooks reference
  pages from the parser, the settings table, the MCP server and dry-run hook
  installers; `just docs-check` and the docgen tests fail on a stale page.
- llms.txt, llms-full.txt and a Markdown alternate of every page, including
  the landing page's headings, commands and install line.
- Catppuccin Mocha and Latte as in the app, Geist and Geist Mono, one
  heading scale and focus ring, state colours at 4.5:1 or better.

The landing page leads with real-time screen recordings of the shipped
binary: the terminal from typing `driga` to an allowed permission prompt,
then the same prompt allowed in the browser, then the install command, with
a Terminal · Browser · Install chapter bar. Feature sections play tight
crops of the same takes, light or dark with the site theme; phones get the
Needs-you crop in the hero.

- cmd/driga-demo plays scripted sessions into a private temporary data
  directory: it holds the collector lock, writes the store and runs the real
  prompt broker, so `driga` and `driga web` read it as a live collector. It
  never reads the process table, agent files or Git.
- site/footage records the TUI with VHS and `driga web` with Playwright (a
  drawn pointer, both themes), refusing to film unless the viewer reads the
  demo, and cuts the films with Remotion from film/cut.json.
- Videos live in the R2 bucket driga-assets under content-hashed keys,
  served from assets.driga.dev and listed in src/data/media.json; posters
  are committed. `just site-footage` re-records, `just site-footage-publish`
  uploads.

Docs follow #58 (one-time macOS notification prompt) and #59 (bare `driga`
opens the viewer; no activity, conflicts or --watch). Deployed to Cloudflare
Pages by .github/workflows/site.yml.

Claude-Session: https://claude.ai/code/session_01T2vtcW6ihn1ywy9vxUq9a4
vishr added a commit that referenced this pull request Oct 24, 2026
A Starlight site for driga.dev, built from the code where it can be:

- cmd/driga-docgen writes the CLI, settings, MCP tools and hooks reference
  pages from the parser, the settings table, the MCP server and dry-run hook
  installers; `just docs-check` and the docgen tests fail on a stale page.
- llms.txt, llms-full.txt and a Markdown alternate of every page, including
  the landing page's headings, commands and install line.
- Catppuccin Mocha and Latte as in the app, Geist and Geist Mono, one
  heading scale and focus ring, state colours at 4.5:1 or better.

The landing page leads with real-time screen recordings of the shipped
binary: the terminal from typing `driga` to an allowed permission prompt,
then the same prompt allowed in the browser, then the install command, with
a Terminal · Browser · Install chapter bar. Feature sections play tight
crops of the same takes, light or dark with the site theme; phones get the
Needs-you crop in the hero.

- cmd/driga-demo plays scripted sessions into a private temporary data
  directory: it holds the collector lock, writes the store and runs the real
  prompt broker, so `driga` and `driga web` read it as a live collector. It
  never reads the process table, agent files or Git.
- site/footage records the TUI with VHS and `driga web` with Playwright (a
  drawn pointer, both themes), refusing to film unless the viewer reads the
  demo, and cuts the films with Remotion from film/cut.json.
- Videos live in the R2 bucket driga-assets under content-hashed keys,
  served from assets.driga.dev and listed in src/data/media.json; posters
  are committed. `just site-footage` re-records, `just site-footage-publish`
  uploads.

Docs follow #58 (one-time macOS notification prompt) and #59 (bare `driga`
opens the viewer; no activity, conflicts or --watch). Deployed to Cloudflare
Pages by .github/workflows/site.yml.

Claude-Session: https://claude.ai/code/session_01T2vtcW6ihn1ywy9vxUq9a4
vishr added a commit that referenced this pull request Oct 24, 2026
A Starlight site for driga.dev, built from the code where it can be:

- cmd/driga-docgen writes the CLI, settings, MCP tools and hooks reference
  pages from the parser, the settings table, the MCP server and dry-run hook
  installers; `just docs-check` and the docgen tests fail on a stale page.
- llms.txt, llms-full.txt and a Markdown alternate of every page, including
  the landing page's headings, commands and install line.
- Catppuccin Mocha and Latte as in the app, Geist and Geist Mono, one
  heading scale and focus ring, state colours at 4.5:1 or better.

The landing page leads with real-time screen recordings of the shipped
binary: the terminal from typing `driga` to an allowed permission prompt,
then the same prompt allowed in the browser, then the install command, with
a Terminal · Browser · Install chapter bar. Feature sections play tight
crops of the same takes, light or dark with the site theme; phones get the
Needs-you crop in the hero.

- cmd/driga-demo plays scripted sessions into a private temporary data
  directory: it holds the collector lock, writes the store and runs the real
  prompt broker, so `driga` and `driga web` read it as a live collector. It
  never reads the process table, agent files or Git.
- site/footage records the TUI with VHS and `driga web` with Playwright (a
  drawn pointer, both themes), refusing to film unless the viewer reads the
  demo, and cuts the films with Remotion from film/cut.json.
- Videos live in the R2 bucket driga-assets under content-hashed keys,
  served from assets.driga.dev and listed in src/data/media.json; posters
  are committed. `just site-footage` re-records, `just site-footage-publish`
  uploads.

Docs follow #58 (one-time macOS notification prompt) and #59 (bare `driga`
opens the viewer; no activity, conflicts or --watch). Deployed to Cloudflare
Pages by .github/workflows/site.yml.

Claude-Session: https://claude.ai/code/session_01T2vtcW6ihn1ywy9vxUq9a4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant