Skip to content

Open the Paste Bar on the current Space - #117

Open
logeshsn wants to merge 1 commit into
momenbasel:mainfrom
logeshsn:fix/bar-follows-active-space
Open

logeshsn wants to merge 1 commit into
momenbasel:mainfrom
logeshsn:fix/bar-follows-active-space

Conversation

@logeshsn

Copy link
Copy Markdown

Problem

With more than one desktop (Space), pressing the hotkey (⌘⇧V) jumps to Desktop 1 instead of opening the Paste Bar on the current desktop.

Cause

BarWindowController.show() calls NSApp.activate(ignoringOtherApps: true) before makeKeyAndOrderFront. macOS's "When switching to an application, switch to a Space with open windows for the application" setting is on by default. With it on, activating Pesty while one of its regular windows (Settings, Preview) is open on another Space moves the user to that Space. The bar itself is fine (canJoinAllSpaces), but the activation moves the user away from the Space they were on.

Fix

Remove the activate call from show(). The bar is a .nonactivatingPanel whose canBecomeKey returns true, so makeKeyAndOrderFront gives it key focus without activating the app. That is the path the existing comment in init() already relies on for Secure Event Input. Because Pesty is no longer activated, the previously frontmost app stays frontmost, which also suits the paste-back flow.

One line changed in Sources/Pesty/UI/BarWindowController.swift. No visual change to the strip.

Testing

  • swift build: clean.
  • swift test: 39 tests, 0 failures.
  • Built with scripts/build_app.sh and installed locally on macOS 27.2. Manual check across Spaces is pending: hotkey on Desktop 2 with Settings open on Desktop 1, then arrows, search, Return to paste, and Esc.

Not checked: main-menu key equivalents (for example ⌘Z) while the bar is key and the app is inactive.

🤖 Generated with Claude Code

show() called NSApp.activate(ignoringOtherApps:) before ordering the panel
in. With macOS's default "switch to a Space with open windows for the
application" setting, activating Pesty while its Settings or Preview window
sits on another Space jumps the user to that Space, so the hotkey always
landed on Desktop 1.

The bar is a .nonactivatingPanel with canBecomeKey, so it takes key focus
without activating the app. Drop the activate call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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