All posts

7 min readPost 9

Tray, window and context menu: the half for humans

Obituary started agent-first, yet approving folder policies, browsing buried files, and rescuing a mistake are human decisions. Here is why we moved from a 5-minute scheduled task to the resident obitd tray daemon, why the tray refuses to call resurrect --last, why we chose Wails for the desktop calendar, and the trade-offs behind File Explorer desktop.ini date labels.

On this page
  1. Moving from a 5-minute scheduled task to a resident tray daemon
  2. The desktop window: choosing Wails and building a calendar
  3. Context menus and approval-gated folder policies
  4. Showing burial dates inside File Explorer with desktop.ini

Obituary began strictly agent-first: CLI commands, pre-execution delete hooks, an MCP server, and a hidden scheduled task waking every 5 minutes. Put that pure-CLI workflow in front of real daily use and half the product was missing: approving a folder rule, browsing what sits in the graveyard, and clicking to restore a buried file are human decisions. Anyone who did not want to live in a terminal got stuck the moment a proposal waited for review.

Across a single day on 10 November we built out the human-facing half: classic File Explorer context menus and folder policies in the early afternoon, the resident tray daemon an hour later, the desktop window backend and Explorer date labels by 17:00, and the React calendar interface by 21:00.

Moving from a 5-minute scheduled task to a resident tray daemon ​

Our first design explicitly avoided a tray icon, relying on a hidden 5-minute scheduled task for expiry cleanup. Two needs broke that design: a periodic task cannot watch a Downloads folder in real time, and it cannot act as a long-lived single writer coordinating bursts of concurrent agent hooks.

On the evening of 9 November we switched obitd to a lightweight resident tray process—starting at login, single-instance, quietly handling expiry sweeps, folder watching, and ledger coordination without ever popping unsolicited windows. Every building block was off the shelf:

  • Tray icon: fyne.io/systray.
  • Single instance: Win32 named mutex via golang.org/x/sys/windows.
  • Folder watching: fsnotify.
  • Login startup: current-user Windows Run registry key.
  • Memory cap: runtime/debug.SetMemoryLimit.

The scheduled task stepped back into a safety fallback whenever the tray is not running.

Why the tray's "Recently buried" menu never calls obit resurrect --last ​

The tray menu lists the 10 most recently buried items (both manual and expired) with filename, original folder, time, and source. Clicking a row resurrects only that entry through the full safety checks, showing any error right inside the menu instead of throwing a modal popup.

The CLI already had obit resurrect --last, yet the tray intentionally refuses to call it. On the CLI, --last scopes itself to the active agent session or working repository. A tray daemon owns neither a session nor a project directory; calling --last from the tray would undo the most recent machine-wide batch and risk restoring unrelated files. One explicit click on a single row trades convenience for zero surprise restores.

The desktop window: choosing Wails and building a calendar ​

Choosing "Open Obituary" from the tray opens a five-page desktop window:

  • Expiring soon: review active timers, extend lifespans, or stop tracking.
  • Graveyard: search, resurrect, or permanently purge early.
  • For you: approve or reject proposals and pending rules.
  • Settings: configure folder policies, graveyard vs. Recycle Bin mode, retention days, context menus, and startup.
  • Log: inspect recent actions.

Closing the window leaves only the lightweight tray daemon running.

Weighing five GUI toolkits ​

With our Go core already hardened, we compared five UI paths:

  • Raw Win32: smallest and fastest, but a full rewrite once macOS and Linux arrive.
  • Fyne and webview_go: require a C compiler, breaking our zero-CGO discipline.
  • Gio: full custom immediate-mode layout, too costly for rich bilingual UI polish.
  • Separate C# WinUI app: introduces a second language and IPC glue layer.
  • Wails v2 (chosen): renders a web frontend inside the OS WebView2 while binding directly to our Go core with zero CGO, letting us reuse the exact same React UI across Windows, macOS, Linux, and our live website demo.

We accepted the clear trade-offs: maintaining a React frontend and paying ~50–100 MB of WebView2 RAM while the window is open (freed on close). By 21:00 that evening the initial table layout had evolved into a bilingual React calendar showing every file on the exact day it will be buried or purged.

Screenshot of the desktop window's Expiring soon page in Calendar view: items arranged across days 21 to 28 with tabs for Expiring soon, Graveyard, For you, Settings, and Log
The desktop window's Expiring soon page in Calendar look (sample data): each card sits on its expiry date, with quick actions to extend or spare.
Screenshot of the For you page showing the four-way automatic registration switch and grouped pending proposals with Reject and Approve buttons
The For you page: proposals grouped by source with plain reasons so users can approve or reject without opening a terminal.

Context menus and approval-gated folder policies ​

Two desktop entrypoints rounded out human workflows:

  • Classic Windows Explorer context menu: registered via the registry (under "Show more options" on Windows 11), letting you right-click one or more files or folders to assign a 1-, 7-, or 30-day lifespan or bury immediately, followed by a toast reporting succeeded and failed counts.
  • Folder policies (obit watch): attaches a default lifespan to every top-level file appearing inside folders like Downloads, counted from first sight. Because a policy governs an entire directory, it never activates silently—both obit watch and the folder-background menu item only create a pending proposal until explicitly approved via obit approve or the desktop window.

Showing burial dates inside File Explorer with desktop.ini ​

Opening a dedicated app to check which Downloads files are about to expire adds friction. Windows File Explorer natively supports an obscure feature: placing a hidden, system-attributed Unicode desktop.ini with a [LocalizedFileNames] section overrides the displayed label without touching the real filename on disk. By default this runs only in Downloads, Desktop, and watched folders—never Git repositories—and can be tuned under [explorer] in config.toml.

Terminal run showing obit watch proposing a folder policy, obit approve activating it, the folder gaining its read-only bit, and hidden desktop.ini encoding burial date labels for each file
Isolated demo run: approving a folder policy sets the directory read-only flag and writes a hidden desktop.ini giving each tracked file a burial-date display label.

Using a native Windows mechanism avoids shipping an in-process Explorer shell extension, with four honest caveats:

  • The folder gets the read-only attribute (Microsoft's required switch for desktop.ini) alongside the hidden desktop.ini file; writes reuse our handle-pinned safe-edit path to preserve existing user sections, alternate data streams, and attributes.
  • Explorer caches display names aggressively: after extending a file's lifespan, an already-open Explorer window can show the old date for up to ~1 minute. We tested eight different shell refresh notifications and none forced an instant repaint.
  • Pressing F2 on a labeled folder edits its display label rather than its real path; real renames stay tracked via NTFS 128-bit file ID.

All posts