Fix snap overlay showing on wrong monitor in multi-monitor setups#46
Open
jpenberthy wants to merge 1 commit intoBasGeertsema:mainfrom
Open
Fix snap overlay showing on wrong monitor in multi-monitor setups#46jpenberthy wants to merge 1 commit intoBasGeertsema:mainfrom
jpenberthy wants to merge 1 commit intoBasGeertsema:mainfrom
Conversation
When Ctrl+dragging a window to snap it on a multi-monitor setup, the snap overlay grid would appear on the wrong monitor instead of following the cursor. Each monitor creates its own WindowSnapper instance, but the #onWindowMoved handler didn't check whether the pointer was within its monitor's bounds. This caused overlays on other monitors to remain visible or activate incorrectly. Added a bounds check in #onWindowMoved that hides the overlay and cancels highlights when the pointer leaves a snapper's monitor area. Also properly hides the container when showRegions becomes false, which was previously a no-op (the container would stay visible). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WindowSnapperinstance, but the#onWindowMovedhandler never checked if the pointer was within its monitor's bounds. This meant overlays on other monitors would stay visible or activate incorrectly.#onWindowMovedthat hides the overlay and cancels highlights when the pointer leaves a snapper's monitor area. Also properly hides the container whenshowRegionsis false (previously theelsebranch was missing, so the container would stay visible even after the modifier key was released).Details
The change is scoped to
#onWindowMovedinwindow-snapper.js:onMotionlogic, but now also hide the container whenshowRegionsbecomes false (the missingelsebranch).This ensures that only the monitor under the cursor shows the snap grid overlay, and the overlay properly disappears when the modifier key is released.
Test plan
🤖 Generated with Claude Code