S047: close to tray on Wayland: window reopens, hidden runs tested, tools/tray-check
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
2488f1282c
commit
a601765855
3 changed files with 151 additions and 7 deletions
|
|
@ -280,3 +280,9 @@ Seen: boxes were ticked together after the tests, against rule 3.
|
|||
- Same-size replies with other dates/tags (nginx `W/"size-mtime"`) are checked by 64 KiB of bytes before writing; proven versions per link, no If-Range on a farm, `tasks.farm` stored (migration 007). HTTP only; FTP keeps mtime strict.
|
||||
- testserver `farm=N`, `liar=1`; `crates/core/tests/farm.rs`. Hidden smoke on a farm passed; dist/ rebuilt (0.1.1), copied to `~/Projects/Medlar/dist/`.
|
||||
- Not done: `connector_flood_15` fails (connector untouched), CPU right after done 160 %, packaged builds not launched, no real farm.
|
||||
|
||||
## S047 — Close to tray on Wayland
|
||||
- One `egui::Context` and the `App` live in `open()`; windows come and go via `run_native_ext` + `run_and_return`; while closed `App::hidden` ticks tray, port and second starts, waking on repaint requests. Stopgap removed.
|
||||
- Hidden nested niri with a fake tray host (`tools/tray-check/`): close stays, 0 % CPU, port answers, tray Show / POST / second start reopen, download finishes hidden, tray Quit ends; no host: close quits. Suite 576 passed.
|
||||
- Not tested: Ctrl+Q key, tray Pause/Resume all and notification actions while hidden, X11, real tray hosts, packages (not rebuilt).
|
||||
- Later: clipboard monitoring while hidden; reopen if the tray host vanishes while hidden.
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@ Fixes and small changes after 0.1.0. Linux x86_64, glibc 2.44 or newer.
|
|||
dates but the same size, Medlar compares 64 KiB of bytes it already has, or that a known server sent, before writing
|
||||
anything. The same bytes: the download goes on in parts and remembers the farm across restarts. Other bytes or another
|
||||
size: it still stops with "File changed", and what is already downloaded is kept. Two files are never mixed.
|
||||
- **Close to the tray on Wayland.** Closing the window (also with the compositor's close, such as Win+Q on niri) now
|
||||
leaves Medlar running in the tray when "Close to tray" is on and the desktop shows tray icons: downloads, the browser
|
||||
port and the tray keep going, and the window comes back from the tray, a second start or a link from the browser.
|
||||
Without a tray, closing quits as before. Ctrl+Q and the tray's Quit always quit. Starting with `--minimised` opens no
|
||||
window when there is a tray.
|
||||
|
||||
## Known gaps
|
||||
- Needs glibc 2.44 or newer; not tested on other systems.
|
||||
|
|
|
|||
45
docs/tests/S047-close-to-tray.md
Normal file
45
docs/tests/S047-close-to-tray.md
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# S047 — Close to tray that works on Wayland: test file
|
||||
|
||||
Written and run by the S047 session (Phase: test).
|
||||
|
||||
## Built
|
||||
- `crates/app/src/app.rs` · `open()` makes one `egui::Context` and the `App` before any window; the window runs through `eframe::run_native_ext(.., Some(ctx), ..)` with `run_and_return`, borrowing the `App` (`Window<'a>`). Closing with close to tray on and a tray host returns to `App::hidden`, which runs without a window until Show, an arrival or Quit; then the window opens again or the app quits (pause/save via `bridge.close()` only then).
|
||||
- `App::hidden` wakes on every repaint request (a `set_repaint_observer` into a 1-slot channel), plus a 2 s look round. It ticks the shell (tray, notifications, launcher), the inbox (port, second starts) and saves changed settings. No frames are drawn.
|
||||
- `App::act` · tray/notification actions shared by the window and the hidden loop; Add and Sign in queue their dialog and ask for the window.
|
||||
- `shell::hides(quitting, close_to_tray, host)` · the decision; the Wayland stopgap is gone, `CancelClose`/`Visible(false)` are no longer used.
|
||||
- `views/incoming.rs` · `raise()` also sets a flag (`take_raised`) so that an arrival while hidden reopens the window.
|
||||
- `Main::all(resume)` · pause/resume all, also without a window.
|
||||
- `--minimised` with a tray host starts without a window.
|
||||
- `tools/tray-check/` · hidden nested niri runs with a fake StatusNotifierWatcher (Python Gio) on the run's private bus.
|
||||
|
||||
## Checks
|
||||
Risk: HIGH = data loss, security, crash, wrong result · MED = feature broken · LOW = looks or comfort.
|
||||
|
||||
| # | Risk | Do this | Expect | How | Result |
|
||||
|---|---|---|---|---|---|
|
||||
| 1 | HIGH | `hides(quitting, close_to_tray, host)` for all cases | Hides only with close to tray on, a host and no quit | unit `shell::tests` | pass |
|
||||
| 2 | HIGH | Hidden run, fake tray host, close the window (`niri msg action close-window`) | No window, process stays | `tools/tray-check/run.sh tray tray.sh 1` | pass |
|
||||
| 3 | MED | While hidden and idle, CPU over 5 s | ~0 % | same run (`cpu 5`) | pass: 0.00 % |
|
||||
| 4 | HIGH | While hidden, GET the connector port | Answers | same run | pass: 200 |
|
||||
| 5 | MED | Tray `Activate` (left click) over D-Bus | Window comes back where it was | same run, grab `shown` | pass |
|
||||
| 6 | HIGH | Close, then POST `{url, filename}` to the port | Window reopens with the Add dialog filled in | same run, grab `add` | pass |
|
||||
| 7 | HIGH | Start a throttled 4 MB download (300 kB/s), close at 15 %, wait 18 s hidden, Show from the tray | Download kept going: Done 100 % | same run, grabs `started`, `after` | pass |
|
||||
| 8 | HIGH | Close, then tray menu Quit (dbusmenu Event on the "Quit" item) while hidden | Process ends within 10 s, exit 0, no panic | same run | pass |
|
||||
| 9 | HIGH | No tray host; close the window | Process ends (quit as before) | `run.sh notray notray.sh` | pass |
|
||||
| 10 | MED | `--minimised` with a tray host, second start 5 s later | No window until the second start, then it opens; tray menu answers | `MEDLAR_ARGS=--minimised run.sh min min.sh 1 1` | pass: window after 6 s |
|
||||
| 11 | HIGH | Ctrl+Q with close to tray on | Quits (quitting set, `hides` false) | unit for the decision; key path not driven | not run: Ctrl+Q key not sent in the hidden run, only the decision is unit-tested |
|
||||
| 12 | MED | Tray Pause all / Resume all while hidden | Downloads pause / resume without a window | by hand | not run: no driver for these menu items |
|
||||
| 13 | MED | Notification action (Open, Retry) while hidden | Works; Sign in reopens the window with its dialog | by hand | not run: no fake notification daemon in the hidden run |
|
||||
| 14 | LOW | X11 session | Same behaviour (close ends the window, tray reopens) | by hand | not run: only Wayland (nested niri) |
|
||||
| 15 | HIGH | Workspace suite | All pass | `nice cargo test -j 2` | pass: 576 passed, 0 failed, 9 ignored |
|
||||
|
||||
## Needs
|
||||
Release build, `medlar-testserver --port $TS`, spare connector port (`PORT=17997`, never 17616), throwaway home from `tools/hidden.sh`, `python3` with `gi` (Gio), `busctl`. The fake tray host lives on the run's private `dbus-run-session` bus, never the user's.
|
||||
|
||||
## Doubts
|
||||
- Settings changed from the tray while hidden (mode) are applied and saved at once, not through the 0.4 s debounce.
|
||||
- Repaint requests with a delay are not timed while hidden; a 2 s look round covers them (timers that need finer timing would be late).
|
||||
- The clipboard watcher and the drop target do not run while hidden (they need a frame). Clipboard monitoring in the tray: see PROGRESS Later.
|
||||
- If the tray host disappears while hidden, the window stays closed until a second start, a browser link or a notification brings it back.
|
||||
- The `Context` is reused across windows: viewport state from the old window (e.g. close_requested) has shown no effect, but it is not checked beyond these runs.
|
||||
- Wayland only: nothing was run on X11 or on a real Plasma/GNOME tray host; packaged builds were not launched.
|
||||
Loading…
Reference in a new issue