Skip to content

Order tiles by recent app usage (opt-in)#8

Merged
peterp merged 1 commit intomainfrom
feat/usage-ordering
Apr 28, 2026
Merged

Order tiles by recent app usage (opt-in)#8
peterp merged 1 commit intomainfrom
feat/usage-ordering

Conversation

@peterp
Copy link
Copy Markdown
Owner

@peterp peterp commented Apr 28, 2026

New setting: "Order tiles by recent app usage" (default off).

When on, tiles in the overlay are sorted with most-recently-activated apps first. Saved per-display drag order is used only as a tiebreak.

  • Recorded via `NSWorkspace.didActivateApplicationNotification` plus the previously-frontmost app at `show()`
  • Stored in `UserDefaults` key `appUsageOrder` (capped at 128 entries)
  • Keyed by bundle identifier (with `pid:N` fallback) so the rank is stable across windows of the same app
  • Skips cmdcmd itself and non-`.regular` apps
  • Off by default — preserves the existing drag-to-reorder behavior. Turning it on overrides drag order across sessions; an inline note in Settings calls this out.

Credit to @plyght — adapted from #1.

Test plan

  • `./build-app.sh && open cmdcmd.app`
  • Default off → tiles preserve drag-to-reorder as before
  • Turn on → switch through several apps → ⌘⌘ → most recent apps appear first
  • Drag-reorder while on → in-session works visually, but next show reverts to usage order
  • Switch off → next show falls back to saved drag-order
  • Setting persists across restarts

🤖 Generated with Claude Code

New "Order tiles by recent app usage" setting (default off). When on,
tiles are sorted by most-recent activation of their owning app, with
saved drag-order as a tiebreak.

Activation history is recorded via NSWorkspace.didActivateApplicationNotification
and capped at 128 entries in UserDefaults under "appUsageOrder". Keyed by
bundle identifier (with pid:N fallback) so it's stable across windows.

Off by default to preserve user-controlled drag-to-reorder behavior;
turning it on takes over and ignores the saved per-display tile order.

Co-Authored-By: plyght <plyght@peril.lol>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@peterp peterp merged commit f188043 into main Apr 28, 2026
1 check passed
@peterp peterp deleted the feat/usage-ordering branch April 28, 2026 20:48
@peterp peterp mentioned this pull request Apr 28, 2026
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