Skip to content

Add on-monitor-changed config callback#2033

Open
willzeng274 wants to merge 1 commit intonikitabobko:mainfrom
willzeng274:feat/on-monitor-changed
Open

Add on-monitor-changed config callback#2033
willzeng274 wants to merge 1 commit intonikitabobko:mainfrom
willzeng274:feat/on-monitor-changed

Conversation

@willzeng274
Copy link
Copy Markdown

@willzeng274 willzeng274 commented Mar 30, 2026

See the commit message for details.

Config syntax:

on-monitor-changed = 'exec-and-forget sketchybar --reload'

Use case: I use this to reload sketchybar when connecting/disconnecting an external monitor, so workspace items are recreated for the current display configuration.


  • I've read CONTRIBUTING.md
  • My PR contains atomic commits (each commit is a self-contained change with a descriptive message explaining what and why)
  • My PR doesn't contain merge commits (I've rebased on top of the target branch instead)
  • If my PR is ready for review, I've marked it as such (not a draft)
  • I've added a link to the relevant GitHub Discussion (if applicable)
  • I've tested my changes manually

@willzeng274 willzeng274 force-pushed the feat/on-monitor-changed branch 3 times, most recently from 462877a to dd5f019 Compare March 30, 2026 03:47
Users often need to reload external tools (e.g. sketchybar) when monitors
are connected or disconnected. AeroSpace detects monitor changes internally
but doesn't expose a hook for it.

Uses CGDisplayReconfigurationCallback for reliable detection (NSApplication
notifications aren't delivered to agent apps). The callback fires after
layoutWorkspaces() so external tools see the final state.

Config syntax:
  on-monitor-changed = 'exec-and-forget sketchybar --reload'

Also adds monitor-changed to `aerospace subscribe` event types.
@willzeng274 willzeng274 force-pushed the feat/on-monitor-changed branch from dd5f019 to ac47c69 Compare March 30, 2026 03:49
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