Skip to content

Slide the notch along its edge with Alt+drag, as the Mac's ⌥-drag does - #276

Merged
vinzdg merged 1 commit into
vinzdg:mainfrom
RawJat:feat/windows-alt-drag
Sep 20, 2026
Merged

vinzdg merged 1 commit into
vinzdg:mainfrom
RawJat:feat/windows-alt-drag

Conversation

@RawJat

@RawJat RawJat commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

This takes the first option in #251: full parity with the Mac's ⌥-drag.

What changes. The drag now needs Alt held; without it every press on the pill is a click, so a click on a ring that slips refreshes it instead of carrying the notch off. With Alt, the notch follows the pointer along the edge it is on and nowhere else, inside the work area, and never changes edge — the move handle from #246 and the Edge picker in Settings do that. It is NotchWindowController.dragged on the Mac, which only ever moves alongOffset.

Each edge remembers its own place, as the Mac keeps notchOffset.<edge>. A move to another edge lands where the notch was last left there, centred if it has never been slid along it, and Recentre centres only the edge it is on. A carry used to land centred on purpose, because every edge shared one position and a carry dragged the old edge's fraction along; with a place per edge that reason is gone.

The place is stored as a fraction of the edge rather than the Mac's points (notch_along, 0.5 = centred). That lets an existing notch_y become the place for the edge it was saved on without a screen to convert it, and keeps the notch in the same part of the edge across a resolution change. notch_y is read once and never written back.

One thing is lost, and it is worth saying plainly: dragging no longer takes the notch to another monitor. The Screen picker in Settings does, as on the Mac, and its caption no longer claims the drag can.

Settings text. The drag hint is the Mac's own sentence — "Hold ⌥ and drag the notch to slide it along its edge. Each edge remembers where you left it." — with its ru, zh-Hans, zh-Hant, ja and uk translations taken from Localizable.xcstrings, ⌥ read as Alt. The Mac has no Korean, so that sentence is new and worth a native eye. The Ukrainian hint had been keyed to an older English sentence and never showed; it does now.

Testing: cargo test 103 pass, 0 fail, 2 ignored — four new: each edge keeps its own place, the old position migrates to the edge it was on, notch_y is never written back, and a slid notch lands exactly where it was let go (along_at inverts edge_origin). Clippy unchanged. All three pages parse.

Checked by hand on Windows 11: a plain press or a slipped click on a ring never moves the notch and still refreshes it; Alt+drag slides it along its current edge only and stops at the ends of the work area; a notch slid along one edge and carried to another lands centred there, and returns to where it was left when carried back; Recentre centres only the edge it is on; and the drag hint and Screen caption read the new wording.

Overlaps. #269 moves this code to desktop/ and rewrites drag_begin around platform::drag_slides_along_edge(), so one of the two will need rebasing onto the other; its Linux drag already slides along the edge, so the intent is the same. #274 adds a Russian translation for the Screen caption this shortens, so whichever lands second needs to re-key that one string. #239, #257 and #210 also touch main.rs, in other functions.

Closes #251

A plain press on the pill plus 4 px of movement dragged the window
anywhere, and letting go snapped it to the nearest edge of whichever
monitor it was over, saving one position that every edge shared. Since
vinzdg#244 a click on a ring refreshes it, so a click that slipped moved the
notch instead (vinzdg#251); and since vinzdg#246 the move handle exists to change
edge, so the drag was doing its job too.

The drag now needs Alt held, and without it every press on the pill is a
click. It follows the pointer along the edge the notch is on and nowhere
else, inside the work area, and never changes edge: the move handle and
the Edge picker in Settings do that. It is the Mac's ⌥-drag
(NotchWindowController.dragged), which only ever moves alongOffset.

Each edge now remembers its own place, as the Mac keeps notchOffset per
edge. A move to another edge lands where the notch was last left on that
edge, centred if it has never been slid along it, and Recentre centres
only the edge it is on. A carry used to land centred on purpose, because
every edge shared one position and a carry dragged the old edge's
fraction along with it; with a place per edge that reason has gone.

The place is kept as a fraction of the edge rather than the Mac's points,
so an existing notch_y becomes the place for the edge it was saved on
without needing a screen to convert it, and a change of resolution keeps
the notch in the same part of the edge. notch_y is read once and never
written again.

One thing is lost: dragging no longer takes the notch to another monitor.
The Screen picker in Settings does, as on the Mac, and its caption no
longer claims the drag can. The drag hint is rewritten in the Mac's own
words, with its ru, zh-Hans, zh-Hant, ja and uk translations taken from
Localizable.xcstrings and ⌥ read as Alt; the Mac has no Korean, so that
sentence is new. The Ukrainian hint had been keyed to an older English
sentence and never showed; it does now.
@RawJat
RawJat requested a review from vinzdg as a code owner September 19, 2026 12:06
@vinzdg
vinzdg merged commit 6c2755e into vinzdg:main Sep 20, 2026
4 checks passed
vinzdg added a commit that referenced this pull request Sep 20, 2026
Two of the English sources were reworded by #276 after this branch was
written: the screen hint lost its second sentence, and the pill-drag hint
was replaced by the Alt-drag one, which Russian already carries. Re-pointed
the first and dropped the second so neither falls back to English.

Thanks @unchase.
@vinzdg

vinzdg commented Sep 20, 2026

Copy link
Copy Markdown
Owner

Merged as 6c2755e — this was the cleanest of the four notch PRs. The notch_y read-once migration, #[serde(default)] on notch_along, and the edge_origin/along_at inverse test all held up, and the drag loop staying on its own thread is the right call. Thanks @RawJat.

One thing for a later tidy, not a problem: drag_enabled in config.rs is now referenced nowhere outside that file, and notch_y gaining skip_serializing means a downgrade to 1.15 or earlier loses the saved position and re-centres. I'll note the latter in the release notes.

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.

fix: a plain drag on the Windows notch moves it, so a slipped ring-click relocates it

2 participants