diff --git a/Plans/10 Distribution/S049-niri-focus.md b/Plans/10 Distribution/S049-niri-focus.md new file mode 100644 index 0000000..493be34 --- /dev/null +++ b/Plans/10 Distribution/S049-niri-focus.md @@ -0,0 +1,15 @@ +# S049 — Take focus on niri when a download arrives + +> Category 10 Distribution · Model: Sonnet · Effort: medium · Depends on: S046, S047 · Phase: test · Human: no +> Files touched: crates/app/src/views/incoming.rs, crates/app/src/{desktop,shell}.rs or a new `niri.rs`, docs/tests/S049-niri-focus.md + +## Goal +On niri, `Focus` and `RequestUserAttention` from an app only mark the window urgent (no activation token from a user input), so a download pushed from the browser does not bring Medlar forward. niri has no per-app "allow activation" window rule (the user's `~/.config/niri/caelestia-windowrules.kdl` now has a Medlar rule with `open-focused true`, which only helps for new windows). The global `debug { honor-xdg-activation-with-invalid-serial }` would let every app steal focus: not wanted. + +## Steps +- [ ] When `NIRI_SOCKET` is set and an arrival raises the window (S046 path), ask niri over its IPC socket (JSON, `{"Action":{"FocusWindow":{"id":N}}}`; window id from `"Windows"` matched by our PID and app id `medlar`) to focus our window; no shell, no `niri` binary needed; on any error fall back to today's urgency. A setting "Bring Medlar forward when a download arrives" (default on) in Behaviour +- [ ] Unit test with a fake socket that records the request; hidden nested niri run: POST a link, focused window id equals Medlar's (spare port, throwaway home) +- [ ] Results, PROGRESS, INDEX, commit `S049: …`, push + +## Pitfalls +Read the IPC format of niri 26.04 from its docs or `niri msg --json` output before coding. Never touch the user's niri config. diff --git a/Plans/INDEX.md b/Plans/INDEX.md index 37beeb6..2bb2141 100644 --- a/Plans/INDEX.md +++ b/Plans/INDEX.md @@ -69,6 +69,7 @@ Tracker: https://claude.ai/artifact/XouimfVJS6FYVKskGJ8s7H - [x] [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 - [x] [S048](10%20Distribution/S048-server-farms.md) Servers behind a load balancer with different validators +- [ ] [S049](10%20Distribution/S049-niri-focus.md) Take focus on niri when a download arrives ## Later (after version 1; not run by /orchestrate) diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md index 2ec247e..9480069 100644 --- a/docs/HANDOFF.md +++ b/docs/HANDOFF.md @@ -10,6 +10,8 @@ - S048: server farms (romsgames.net): same-size replies with other dates/tags proven by 64 KiB of bytes, no If-Range, `tasks.farm` (migration 007). Packages rebuilt in `~/Projects/Medlar/dist/` (0.1.1). +- User's niri: `~/.config/niri/caelestia-windowrules.kdl` has a Medlar rule (`open-focused true`; backup `.bak-medlar`). Arrival focus on niri needs S049 (IPC FocusWindow). + **Next three** 1. S047 (`Plans/10 Distribution/S047-close-to-tray-wayland.md`, Opus): close to tray on Wayland via eframe `run_and_return` and a session owned by `main`. 2. Rebuild 0.1.1 packages after S047; give the user `sudo pacman -U ~/Projects/Medlar/dist/Medlar-0.1.1-arch-x86_64.pkg.tar.zst` (sudo needs their password; never type it); tell them to quit the running AppImage first. Ask yes/no for publishing 0.1.1 (version, contents, known bugs).