Skip to content

Omarchy: new-mail toasts on the bar poll (default off) - #222

Merged
jeremy merged 1 commit into
omarchy-setupfrom
omarchy-toasts
Aug 21, 2026
Merged

Omarchy: new-mail toasts on the bar poll (default off)#222
jeremy merged 1 commit into
omarchy-setupfrom
omarchy-toasts

Conversation

@jeremy

@jeremy jeremy commented Aug 20, 2026

Copy link
Copy Markdown
Member

Third of the three-PR stack (theming #220 → setup+bar #225 → this). The design record is in docs/omarchy.md.

What

hey setup omarchy --notify rewrites the hey-unread bar module's exec to hey omarchy bar-status --notify. The same 3-minute tick that lights the indicator now also diffs the unseen Imbox postings against a fingerprint file (~/.local/state/hey-cli/omarchy-poll.json) and sends at most one toast per tick via omarchy-notification-send. One Imbox fetch serves both. --no-notify reverts; a plain re-run leaves it as it is; --remove also deletes the state file.

Enablement lives in the module's exec string — no config key, visible where it acts, gone with --remove.

Design

  • New = an unseen posting not fingerprinted yet, or one whose visible_entry_count grew (a new reply on a known thread). Fingerprints avoid updated_at (churns) and seen (flips on read). Muted threads are remembered but never toast.
  • First run seeds silently — never toast the backlog. Fingerprints carry the server+account identity, so hey accounts use reseeds silently instead of toasting another account's backlog, and re-enabling after a --no-notify stretch drops stale fingerprints first.
  • One toast, replaced not stacked: Sender — Subject for one thread (sender falls back name → email like other renderers), N new in Imbox + first senders for more. The daemon's printed id (-r <id> -p) is cached so the next tick replaces the on-screen toast; a stale id after a shell restart just makes a fresh one.
  • Pruning waits for a complete page: HEY sorts Imbox postings unseen-first, so a page holding any seen posting proves the unseen set is complete; an all-unseen (possibly truncated) page keeps absent fingerprints so a thread pushed off a full page doesn't toast again when it returns.
  • DND honored by construction: omarchy's default app-name omarchy-action bypasses silencing (NotificationLogic.js:34-38), so the toast passes --app-name HEY and SUPER+CTRL+comma mutes it into history like any other app.
  • Click focuses the TUI via the shared omarchy-launch-or-focus-tui exec hint.
  • Same silence discipline as the bar: any error → no output beyond the bar JSON, exit 0. A failed fetch leaves fingerprints untouched; a failed send keeps the undelivered postings out of them so the toast retries next tick.

Why the bar tick and not a push: inline command bar modules are interval-only — Bar.qml has no IpcHandler and omarchy bar has no refresh verb — so event-driven freshness needs a widget plugin, recorded as the follow-up in docs/omarchy.md.

Verified live

First --notify tick seeded 30 fingerprints and toasted nothing; flipping a thread unseen toasted Sender — Subject with the envelope glyph, app: HEY, urgency low, and the focus exec (checked in the daemon's history record); two back-to-back new threads shared one toast id (replaced, not stacked); with DND on, the toast landed in history instead of popping; --no-notify reverted; --remove cleared module + state file.

Copilot AI balanced review requested due to automatic review settings August 20, 2026 20:19
@jeremy
jeremy requested a review from a team as a code owner August 20, 2026 20:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds opt-in Omarchy new-mail notifications to the existing Imbox bar poll.

Changes:

  • Adds --notify/--no-notify setup controls.
  • Tracks unseen postings and sends replaceable notifications.
  • Documents behavior and adds comprehensive tests.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
README.md Documents notification setup.
internal/cmd/omarchy.go Adds flags, polling integration, and state removal.
internal/cmd/omarchy_test.go Extends setup and bar test helpers.
internal/cmd/omarchy_notify.go Implements fingerprints and notifications.
internal/cmd/omarchy_notify_test.go Tests notification and setup behavior.
docs/omarchy.md Records notification design and follow-ups.
.surface Exposes the new setup flags.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/cmd/omarchy_notify.go Outdated
Comment thread internal/cmd/omarchy_notify.go
Comment thread internal/cmd/omarchy_notify.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 22bb874cca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cmd/omarchy_notify.go
Comment thread internal/cmd/omarchy_notify.go
Comment thread internal/cmd/omarchy.go Outdated
@jeremy
jeremy force-pushed the omarchy-toasts branch 2 times, most recently from bfa5521 to 37c66fc Compare August 20, 2026 20:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3663c30160

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cmd/omarchy.go
@jeremy
jeremy changed the base branch from omarchy to omarchy-setup August 20, 2026 20:54
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

_ = saveOmarchyPollState(next)

P2 Badge Stop repeat toasts when poll state cannot be saved

When the notification is delivered successfully but the state directory becomes unwritable or the disk is full, this discarded save error leaves the previous fingerprints and toast ID on disk. Every subsequent three-minute poll therefore classifies the same postings as fresh and sends the notification again, potentially without replacement if the new ID was never persisted. Handle persistence failure so mail is not repeatedly toasted after a successful delivery.


if defaults, defErr := s.defaultBarLayout(); defErr == nil && sameJSON(layout, defaults) {
delete(bar, "layout")

P2 Badge Restore inherited bar defaults after Omarchy upgrades

If setup copied Omarchy's default layout and Omarchy upgrades that default before --remove runs, the remaining layout is the old snapshot and no longer equals defaultBarLayout(). This condition then leaves the explicit old layout in shell.json, permanently pinning the user to obsolete bar modules instead of returning them to inherited defaults. Track whether setup seeded the layout, or retain the seeded baseline so an untouched snapshot can still be removed after an upgrade.


return true, os.WriteFile(path, data, perm)

P2 Badge Replace user configuration files atomically

When reconciling an existing shell.json or menu file, os.WriteFile truncates the destination before the replacement has been fully written. An interrupted setup process or an ENOSPC error can therefore leave the user's central Omarchy shell configuration truncated and invalid even though the step reports failure. Write to a temporary file in the same directory and rename it over the destination, as the repository already does for its own configuration.


if !c.env.detected() {
return output.ErrUsageHint("Omarchy not detected", "hey setup omarchy needs ~/.local/state/omarchy or OMARCHY_PATH")
}

P2 Badge Allow removal after Omarchy is no longer detected

When Omarchy has already been uninstalled or its state directory was removed, this unconditional detection check rejects hey setup omarchy --remove before cleanup starts. The HEY desktop entry, poll state, and any surviving configuration files can therefore be left behind with no supported removal path. Skip the detection requirement for --remove, since those cleanup operations only need their known paths.


if len(failures) > 0 {
return output.ErrUsageHint(strings.Join(failures, "; "), "fix the paths above and run hey setup omarchy again")

P2 Badge Return step results when setup partially fails

When any setup step fails under --json, this returns before writeOK, so the response omits every successful and failed step even though setup has already made partial filesystem changes; the hint also says to fix “the paths above” although JSON output printed no paths. Return the structured step results with the failure, or include the affected paths and statuses in the error so scripts can reliably reconcile the partial installation.

AGENTS.md reference: AGENTS.md:L7-L9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 804e7d387e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cmd/omarchy_notify.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 559ce71a3f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cmd/auth.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2a46dcf6d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cmd/omarchy_notify.go
Comment thread internal/cmd/omarchy_notify.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 50d00e71f3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cmd/omarchy_notify.go Outdated
Comment thread internal/cmd/omarchy.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1b356a642a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cmd/omarchy_notify.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce605df7da

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cmd/omarchy_notify.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7be29f94be

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cmd/omarchy.go Outdated
Comment thread internal/cmd/omarchy.go Outdated
@jeremy
jeremy force-pushed the omarchy-toasts branch 3 times, most recently from 391d438 to bc8592d Compare August 21, 2026 00:19

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc8592dab1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cmd/omarchy.go
@jeremy
jeremy force-pushed the omarchy-toasts branch 2 times, most recently from 70660af to eac5671 Compare August 21, 2026 01:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eac5671bf0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cmd/omarchy_notify.go
Comment thread internal/cmd/omarchy.go Outdated
Comment thread internal/cmd/omarchy.go Outdated
hey setup omarchy --notify rewrites the hey-unread bar module's exec to
hey omarchy bar-status --notify, so the same 3-minute tick that lights the
indicator also diffs the unseen Imbox postings against a fingerprint file
(~/.local/state/hey-cli/omarchy-poll.json) and sends at most one toast via
omarchy-notification-send. One Imbox fetch serves both; enablement lives in
the exec string where it acts, with no config key, and --no-notify or
--remove takes it back out (--remove also deletes the state file).

New means an unseen posting not fingerprinted yet, or one whose
visible_entry_count grew -- a new reply on a known thread. Fingerprints
avoid updated_at (it churns) and seen (it flips on read); muted threads are
remembered but never toast. The first run seeds silently so the backlog is
never toasted. One new thread reads "Sender -- Subject", more read "N new in
Imbox" with the first few senders. The daemon's printed id is cached and
passed back with -r so consecutive ticks replace the on-screen toast instead
of stacking; a stale id after a shell restart just makes a fresh one.

The toast identifies as --app-name HEY on purpose: omarchy's default
app-name omarchy-action bypasses notification silencing, so HEY is what
makes SUPER+CTRL+comma mute these like any other app. Clicking focuses the
TUI through the same launch-or-focus exec every other surface uses. Errors
-- auth, network, a failed send -- stay as silent as the bar itself and
leave the fingerprints untouched.
@jeremy
jeremy merged commit ab9d2c7 into main Aug 21, 2026
23 checks passed
@jeremy
jeremy deleted the omarchy-toasts branch August 21, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants