Skip to content

Let the user choose which screen the bar appears on - #88

Merged
oNaiPs merged 2 commits into
mainfrom
feature/screen-selection
Oct 17, 2026
Merged

oNaiPs merged 2 commits into
mainfrom
feature/screen-selection

Conversation

@oNaiPs

@oNaiPs oNaiPs commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Adds a Screen picker to Settings → Appearance, next to Position:

  • Screen with active window (default): the screen holding most of the frontmost app's top window. The panel never activates dmenu-mac, so the frontmost app is still the one you were in. Window bounds come from CGWindowListCopyWindowInfo, which needs no Screen Recording permission or entitlement. Falls back to NSScreen.main, which is what the bar used before, so existing users see no change.
  • Screen with mouse pointer
  • Primary screen (NSScreen.screens.first)

The setting is persisted in AppearanceManager and included in Reset to Defaults.

New CLI flag -m, --monitor <n> (0-based screen index, like dmenu's -m) overrides the setting for that run. Out-of-range or negative indices fall back to the setting.

The bar is now placed within the chosen screen's visibleFrame instead of frame, so it stays below the menu bar and above the Dock on every display.

Screen picking lives in ScreenPicker, which works on a small ScreenDescribing protocol so tests can use fake screens. Edits to shared files (SearchViewController, AppearanceSettings*, project.pbxproj) are kept small.

Testing

  • New ScreenPickerTests: each mode, pointer on a top edge, windows that span screens, the fallbacks, and the monitor override, including out-of-range values.
  • Argument parsing tests for -m/--monitor, plus settings persistence, reset and model notification tests.
  • xcodebuild ... test: 230 tests, 0 failures. swiftlint --strict: 0 violations.

🤖 Generated with Claude Code

Add a Screen setting in Appearance (active window, mouse pointer, or
primary screen) and a -m/--monitor flag that picks a screen by index
for one run. The bar is placed within the screen's visible frame so it
stays clear of the menu bar and the Dock on every display.
Ignore invisible, tiny and off-screen windows when finding the active
window's screen, and move that lookup into a pure function with tests.
Only inset the bar vertically, so a Dock on the side no longer narrows
it. Document the bar's placement and that -m follows the display order.
@oNaiPs
oNaiPs merged commit 416f0bc into main Oct 17, 2026
3 checks passed
@oNaiPs
oNaiPs deleted the feature/screen-selection branch October 17, 2026 13:22
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