S047: plan for close to tray on Wayland
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
fdbb007f53
commit
7831445a6c
2 changed files with 31 additions and 0 deletions
30
Plans/10 Distribution/S047-close-to-tray-wayland.md
Normal file
30
Plans/10 Distribution/S047-close-to-tray-wayland.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# S047 — Close to tray that works on Wayland
|
||||
|
||||
> Category 10 Distribution · Model: Opus (ownership refactor of the app's lifetime) · Effort: medium · Depends on: S046 · Phase: test · Human: 🧑 yes before release
|
||||
> Files touched: crates/app/src/{main,lib,app,shell,tray,instance}.rs, crates/app/src/views/incoming.rs, docs/tests/S047-close-to-tray.md, docs/releases/0.1.1.md
|
||||
|
||||
## Goal
|
||||
The user closes the window with niri's close (Win+Q) and nothing happens. Cause (`app.rs` `shell()`): on close Medlar sends `CancelClose` then `Visible(false)`, but winit cannot hide a window on Wayland, so the window just stays. Without a tray host the close works; with one it is swallowed.
|
||||
|
||||
Wanted: closing hides Medlar to the tray (downloads, port, tray keep going) when the tray is on and a host exists; otherwise it quits cleanly. Show from the tray, a second start, or a browser hand-off brings a window back.
|
||||
|
||||
## Approach (check against eframe 0.37 docs before coding)
|
||||
eframe with `NativeOptions::run_and_return = true` returns from `run_native` when the window closes and reuses its thread-local event loop on the next `run_native` call (winit `run_app_on_demand`). So:
|
||||
- Move what must outlive a window out of `App` into a `Core`/`Session` owned by `main`: engine/manager bridge, connector `Inbox` source, tray/shell, notifications, launcher, instance socket, settings store. The `App` borrows or holds an `Arc` to it.
|
||||
- On close with tray: let the close happen (no `CancelClose`); `run_native` returns; `main` waits on the tray/instance/connector for "show" (or "quit"), then calls `run_native` again with the same session. Window size and position come back from `window.ron`.
|
||||
- Without a tray host, or tray off: close quits as today (pause and save, then exit).
|
||||
- X11: same path (no special `Visible(false)` case left), so one behaviour everywhere.
|
||||
- `--minimised` at start: start without a window when a tray host exists (wait for "show"), else open normally.
|
||||
- Arrivals while hidden (S046 raise): reopen the window, then the Add dialog.
|
||||
If `run_and_return` cannot reopen on this eframe/winit, stop and report with the error; do not build a second process design without asking.
|
||||
|
||||
## Steps
|
||||
- [ ] Read eframe 0.37 `run_and_return` / `run_native` docs and source in ~/.cargo/registry; confirm reopen works with a 20-line spike in a test or example
|
||||
- [ ] Session refactor: long-lived parts out of `App`; nothing else changes behaviour
|
||||
- [ ] Close/show/quit loop in `main` as above; tray Show and Quit, second instance, connector arrival, `--minimised`
|
||||
- [ ] Tests: unit for the decide-on-close logic (tray on/off, host yes/no); hidden nested niri run with a fake StatusNotifierWatcher (bus.rs from S043) on a spare port and throwaway home: send close (niri msg action close-window), process stays, downloads keep going (testserver, throttled), port answers; tray Show reopens; POST to the port reopens with the Add window; Quit ends with tasks saved; without the fake tray, close quits
|
||||
- [ ] Full workspace suite once, release build, smoke as S046; add to docs/releases/0.1.1.md; rebuild packages via tools/package.sh (0.1.1), nothing into releases/
|
||||
- [ ] Test file with Results, PROGRESS, tick INDEX, commit `S047: …`, push
|
||||
|
||||
## Pitfalls
|
||||
The user's Medlar 0.1.0 is running on 17616: never stop it; spare port, throwaway home. Never weaken a test. Idle (hidden) draws no frames and uses ~0 CPU.
|
||||
|
|
@ -67,6 +67,7 @@ Tracker: https://claude.ai/artifact/XouimfVJS6FYVKskGJ8s7H
|
|||
|
||||
- [x] [S045](10%20Distribution/S045-installer-arch.md) installer.sh and Arch package
|
||||
- [ ] [S046](10%20Distribution/S046-fixes-0.1.1.md) 0.1.1: names from the server, raise on arrival, copy in fields
|
||||
- [ ] [S047](10%20Distribution/S047-close-to-tray-wayland.md) Close to tray that works on Wayland
|
||||
|
||||
## Later (after version 1; not run by /orchestrate)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue