From 86c1d52ca921b6b12754fb1b6100a9d99cf7a3fb Mon Sep 17 00:00:00 2001 From: astar76 Date: Wed, 18 Nov 2026 06:35:48 -0600 Subject: [PATCH] plans: S071 tab tear-off and drop into another window (from the original Nacre) Co-Authored-By: Claude Opus 5.5 --- Plans/10 Hardening/S071-tab-tear-off.md | 35 +++++++++++++++++++++++++ Plans/INDEX.md | 3 ++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Plans/10 Hardening/S071-tab-tear-off.md diff --git a/Plans/10 Hardening/S071-tab-tear-off.md b/Plans/10 Hardening/S071-tab-tear-off.md new file mode 100644 index 0000000..8f3544e --- /dev/null +++ b/Plans/10 Hardening/S071-tab-tear-off.md @@ -0,0 +1,35 @@ +# S071 — Drag a tab out into its own window, and back into another + +> Category 10 Hardening · Model: Opus · Effort: high · Depends on: S059 · Size: M · Human: 🧑 user drags tabs between two windows on their screen +> Files touched: src/ui/chrome.rs (tab strip drag ~196–260), src/ui/mod.rs (dragging_tab), src/actions.rs (move tab to new window / to window), src/app.rs (window creation), src/window.rs (GTK drag source/drop target on the window or GLArea), src/egui_area.rs (only if pointer events during a GTK drag need it), src/selftest.rs, tests/smoke/tear-off.txt (new), docs/FEATURES.md + +## Goal +User question (2026-11-18): can tabs be detached and reattached with the mouse? The original Python Nacre could (`~/Documents/Apps/Nacre/nacre/tabs.py`: pulling a tab more than `TEAR` = 28 px above/below the strip turns it into a real drag that can land in another window's strip, `tabsDropped`, or become a window of its own; groups too). Nacre in Rust has only reorder-by-drag and the "Move to new window" menu item: a feature dropped without saying so. Bring it back: +1. Drag a tab more than 28 px off the strip → it becomes a drag; released outside any Nacre strip → the tab opens in a new window with its **live web view** (no reload, media keeps playing, history/back list kept), like "Move to new window". +2. Dropped on another Nacre window's tab strip → the tab joins that window at the drop position (live view moved, window it left closes if it had no tabs left). +3. Dropped back on its own strip → normal reorder. Esc cancels the drag. +4. A tab group chip drags the whole group the same way, if groups exist in the Rust Nacre (check; else note it). + +## Read +- `src/ui/chrome.rs` tab strip and drag code (~190–270); `src/ui/mod.rs` `dragging_tab` +- `src/actions.rs` the "move to new window" command and `win.detach` uses; `src/window.rs` `detach`/attach; S059 entry in `docs/PROGRESS.md` (views follow their tab) +- `~/Documents/Apps/Nacre/nacre/tabs.py` lines 1–20, 340–420 (behaviour only, reference) + +## Steps +- [ ] Check what "Move to new window" does with the web view today (moved live or reloaded); make moving a tab between windows keep the live view (one fn, used by the menu and the drag). +- [ ] Cross-window drop: Wayland gives no global pointer position, so use a GTK drag (`gtk::DragSource` started from the strip when the tab leaves it by 28 px, content = Nacre-internal tab id, only this process) and a `gtk::DropTarget` on every Nacre window that maps the drop x to a strip index; drop outside → new window. Drag icon = the tab's pill. +- [ ] egui side: the strip shows the insertion gap while a drag hovers it; the source strip closes the gap when the tab leaves; Esc cancels. +- [ ] Selftest commands to drive it (drag tab out / onto window N at x) and `tests/smoke/tear-off.txt` (offline, a playing `pages/sound.html` tab torn off keeps playing, dropped into the first window, back list intact); shots. Run it and `basics.txt` only. +- [ ] FEATURES.md line; PROGRESS entry, INDEX line, tracker, commit `S071: …`, push. +- [ ] 🧑 (orchestrator asks the user) drag a tab out, then into the other window, on their screen; note the answer. + +## End criteria +- `cargo test` green; `tear-off.txt` exit 0 (window count, tab counts, `has_web` true and no reload after the moves). + +## Pitfalls +- Never touch `App` in GTK drag signal handlers: queue an Event (CLAUDE.md §3). +- niri places new windows itself; don't try to position them at the pointer. +- A tab in PiP or with a page dialog open: move with it or refuse the tear (say which in PROGRESS). + +## Handoff (→ PROGRESS.md) +How a live view moves between windows, the drag/drop mechanism. diff --git a/Plans/INDEX.md b/Plans/INDEX.md index 9d1a4b9..8d0b986 100644 --- a/Plans/INDEX.md +++ b/Plans/INDEX.md @@ -20,11 +20,12 @@ Dropped with Servo (D-032): S011, S029, S030, S032, S033, S037, S038. - [x] [S065 — Custom download manager by name and port](09%20Fix%20round/S065-custom-manager-port.md) · Sonnet high - [x] [S066 — UI alignment pass (/unslop)](09%20Fix%20round/S066-ui-alignment.md) · Opus medium · 🧑 -## 10 Hardening (after 09; one at a time: S068, S067, S069, S070) +## 10 Hardening (after 09; one at a time: S068, S067, S069, S070, S071) - [ ] [S067 — Passwords ask for your account password](10%20Hardening/S067-os-password-gate.md) · Opus high · 🧑 - [x] [S068 — "Page isn't responding" and crash pages that show](10%20Hardening/S068-page-unresponsive.md) · Opus medium - [ ] [S069 — Keep VRAM use small](10%20Hardening/S069-vram.md) · Opus medium - [ ] [S070 — Media pass: now playing priority, previews, media keys, PiP, controls](10%20Hardening/S070-media-pass.md) · Opus medium · 🧑 +- [ ] [S071 — Drag a tab out into its own window, and back into another](10%20Hardening/S071-tab-tear-off.md) · Opus high · 🧑 ## 02 Verify / 03 Gaps (after 08; reviews need the user) - [ ] [S010 — Phase 2 review with the user](02%20Verify/S010-phase2-review.md) · Sonnet medium · 🧑