From eba577bcb9157bd2b72aee03fe017fd1ec6e18f5 Mon Sep 17 00:00:00 2001 From: Jacob Ward Date: Tue, 1 Dec 2026 21:30:53 -0600 Subject: [PATCH] S020: dead-row test, overview hot corners toggle niri's overview, game mode rows read, unused capture rows hidden Co-Authored-By: Claude Sonnet 5.5 --- Plans/INDEX.md | 2 +- crates/core/src/config.rs | 16 +++++++++ crates/shell/src/background.rs | 4 +-- crates/shell/src/nexus/mod.rs | 48 +++++++++++++++++++++++++-- crates/shell/src/wl.rs | 36 ++++++++++++++++++-- docs/AUDIT.md | 6 ++++ docs/ISSUES.md | 2 +- docs/PROGRESS.md | 4 +++ docs/tests/S020-dead-rows-overview.md | 33 ++++++++++++++++++ 9 files changed, 142 insertions(+), 9 deletions(-) create mode 100644 docs/tests/S020-dead-rows-overview.md diff --git a/Plans/INDEX.md b/Plans/INDEX.md index fb4c503..297abad 100644 --- a/Plans/INDEX.md +++ b/Plans/INDEX.md @@ -33,7 +33,7 @@ Tracker: https://claude.ai/artifact/U7N1biTWurWCSxkAn17xiz - [x] [S017 — Launcher web search and File Types](03%20Features%20and%20config/S017-websearch-filetypes.md) · Opus medium - [x] [S018 — Shell language (translations)](03%20Features%20and%20config/S018-translations.md) · Opus medium - [x] [S019 — Config paths into ~/.config/niri/caelestia](03%20Features%20and%20config/S019-config-paths-niri.md) · Opus high -- [ ] [S020 — Dead settings rows and niri's overview](03%20Features%20and%20config/S020-dead-rows-overview.md) · Opus medium +- [x] [S020 — Dead settings rows and niri's overview](03%20Features%20and%20config/S020-dead-rows-overview.md) · Opus medium - [x] [S028 — Default apps are honoured everywhere](03%20Features%20and%20config/S028-default-apps-honoured.md) · Opus medium - [ ] [S029 — Reorder favourite apps](03%20Features%20and%20config/S029-reorder-favourites.md) · Opus medium - [ ] [S030 — Dock: open apps shown, close from the menu](03%20Features%20and%20config/S030-dock-running-and-close.md) · Opus medium diff --git a/crates/core/src/config.rs b/crates/core/src/config.rs index c0b60bb..a143f90 100644 --- a/crates/core/src/config.rs +++ b/crates/core/src/config.rs @@ -33,6 +33,7 @@ pub struct Config { pub session: Session, pub osd: Osd, pub dashboard: Dashboard, + pub overview: Overview, pub utilities: Utilities, pub sidebar: SidebarCfg, pub background: Background, @@ -962,6 +963,21 @@ pub struct QuickToggle { pub enabled: Option, } +/// `overview` in shell.json. niri has its own overview, so only the hot corners are read: they +/// toggle it (niri addition, S020). The original's overview panel settings are left out (D-004). +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +#[serde(default, rename_all = "camelCase")] +pub struct Overview { + pub enabled: bool, + pub show_on_hover: bool, + pub drag_threshold: f32, + pub hover_thickness: f32, + pub hover_top_left: bool, + pub hover_top_right: bool, + pub hover_bottom_left: bool, + pub hover_bottom_right: bool, +} + /// `dashboard` in shell.json. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] #[serde(default, rename_all = "camelCase")] diff --git a/crates/shell/src/background.rs b/crates/shell/src/background.rs index 316d187..cca5ba7 100644 --- a/crates/shell/src/background.rs +++ b/crates/shell/src/background.rs @@ -725,8 +725,8 @@ impl Bg { } WidgetKind::Shapes => paint_shapes(p, shared, f, playing && !shared.util.game_mode && !(cfg.desktop_shapes.auto_hide && hidden), anim), _ => { - // disableDesktopLyrics, and on niri game mode always stops them (AUDIT.md). - let game = shared.util.game_mode; + // Game mode's `disableDesktopLyrics`. + let game = shared.util.game_mode && shared.cfg.utilities.game_mode.disable_desktop_lyrics; paint_lyrics(p, shared, f, !game && playing && shared.bg.lyrics.has_lyrics() && !(cfg.desktop_lyrics.auto_hide && hidden), anim) } } diff --git a/crates/shell/src/nexus/mod.rs b/crates/shell/src/nexus/mod.rs index fdd5219..f7735db 100644 --- a/crates/shell/src/nexus/mod.rs +++ b/crates/shell/src/nexus/mod.rs @@ -3249,7 +3249,10 @@ fn add_niri_pages(data: &mut Data) { // workspaces are always per monitor, none of them special. let plain = |r: &Row, name: &str| matches!(&r.label, Some(Text::Plain(t)) if t == name); for (page, gone) in [ - ("PanelsPage", &["Overview", "Window Switcher"][..]), + // Overview stays as the hot corners page: the corners toggle niri's overview (D-004). + ("PanelsPage", &["Window Switcher"][..]), + // Read nowhere in the original outside Nexus (HANDOFF), so nothing to attach to. + ("BarScreenCapture", &["Show screenshot buttons", "Show recording buttons"]), ("TaskbarPanel", &["Preview scale", "Live window previews", "Scale with bar size", "Font scaling offset", "Per-element scaling offsets"]), ("BarDock", &["Preview window on desktop"]), // Nothing here reads it: the frame and bar are always one piece. @@ -3269,9 +3272,8 @@ fn add_niri_pages(data: &mut Data) { } } for page in &mut data.pages { - page.settings.retain(|e| !["Overview", "Window Switcher", "Activation", "Preview scale", "Per-element scaling offsets"].contains(&e.label.as_deref().unwrap_or(""))); + page.settings.retain(|e| !["Window Switcher", "Activation", "Preview scale", "Per-element scaling offsets"].contains(&e.label.as_deref().unwrap_or(""))); } - data.subpages.remove("OverviewPanel"); data.subpages.remove("TabSwitcherPanel"); data.subpages.remove("BarPreviewScales"); // The current original's Appearance list: Wallpaper Settings moves up; the skwd-wall @@ -3709,6 +3711,46 @@ mod audit { assert!(top(&n) > was && frames < 1000, "it runs on, then stops"); } + /// Every visible row that edits a `shell:` setting needs a reader: its leaf name (in + /// snake case) must appear in the shell's code outside the config definition (S020). + /// `DEAD_OK` lists rows read by a name this check cannot see. + #[test] + fn no_dead_rows() { + // Read through a method in config.rs: Lock::wallpaper_file, Services::twelve_hour. + const DEAD_OK: &[&str] = &["lock.wallpaperPath", "services.clockFormat"]; + fn rs_files(dir: &std::path::Path, out: &mut Vec) { + for e in std::fs::read_dir(dir).unwrap().flatten() { + let p = e.path(); + if p.is_dir() { + rs_files(&p, out); + } else if p.extension().is_some_and(|x| x == "rs") { + out.push(p); + } + } + } + let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join(".."); + let mut files = Vec::new(); + rs_files(&root, &mut files); + let code: String = files + .iter() + .filter(|p| !p.ends_with("core/src/config.rs") && !p.ends_with("shell/src/fuzz.rs")) + .map(|p| std::fs::read_to_string(p).unwrap()) + .collect::>() + .join("\n"); + let nx = Nexus::new(); + let mut dead = std::collections::BTreeSet::new(); + for (sub, row) in nx.setting_rows() { + let key = row.key.clone().unwrap(); + let Some(path) = key.strip_prefix("shell:") else { continue }; + let leaf = path.rsplit('.').next().unwrap(); + let snake: String = leaf.chars().flat_map(|c| if c.is_uppercase() { vec!['_', c.to_ascii_lowercase()] } else { vec![c] }).collect(); + if !code.contains(&snake) && !code.contains(&format!("shell:{path}")) && !DEAD_OK.contains(&path) { + dead.insert(format!("{path} ({sub})")); + } + } + assert!(dead.is_empty(), "visible rows with no reader: {dead:#?}"); + } + /// Every row a page shows, and whether anything can happen when it is used. #[test] #[ignore] diff --git a/crates/shell/src/wl.rs b/crates/shell/src/wl.rs index d831a7f..c8e8fe9 100644 --- a/crates/shell/src/wl.rs +++ b/crates/shell/src/wl.rs @@ -290,6 +290,8 @@ pub struct App { wake: Option<(std::time::Instant, RegistrationToken)>, /// Where the left button went down, for the edge drags. drag_start: Option<(f32, f32)>, + /// The pointer is in an overview hot corner that already fired (S020). + corner_fired: bool, /// A quick toggle pressed (not yet dragged): its id and where. toggle_press: Option<(String, f32, f32)>, /// 1 dashboard, 2 utilities: opened by hovering the border, so leaving closes it. @@ -430,6 +432,7 @@ pub fn run() -> anyhow::Result<()> { blur: globals.bind(&qh, 1..=1, ()).ok(), wake: None, drag_start: None, + corner_fired: false, toggle_press: None, hover_opened: 0, recorder: None, @@ -2341,6 +2344,32 @@ impl App { } } + /// Overview hot corners: niri's own overview stands in for the original's (D-004). The + /// pointer entering a chosen corner toggles it once (`showOnHover`), or dragging out of + /// the corner past `dragThreshold` does. + fn overview_corner(&mut self, i: usize, x: f32, y: f32) { + let o = self.shared.cfg.overview.clone(); + let ui = &self.screens[i].ui; + let (w, h) = (ui.width, ui.height); + let t = o.hover_thickness.max(1.0); + let corner = |px: f32, py: f32| { + let (l, r, tp, b) = (px < t, px >= w - t, py < t, py >= h - t); + (tp && l && o.hover_top_left) || (tp && r && o.hover_top_right) || (b && l && o.hover_bottom_left) || (b && r && o.hover_bottom_right) + }; + let fire = o.enabled + && if o.show_on_hover { + corner(x, y) + } else { + self.drag_start.is_some_and(|(x0, y0)| corner(x0, y0) && ((x - x0).powi(2) + (y - y0).powi(2)).sqrt() > o.drag_threshold) + }; + if !fire { + self.corner_fired = false; + } else if !self.corner_fired { + self.corner_fired = true; + spawn_cmd(&["niri".into(), "msg".into(), "action".into(), "toggle-overview".into()]); + } + } + /// Interactions.qml: the border is a hot zone. Hovering the top edge opens the dashboard /// (centre) or the utilities (right); dragging in from an edge opens them, the /// notification sidebar and the session menu; hover-opened drawers close when left. @@ -2349,6 +2378,7 @@ impl App { return; } self.right_edge(i, x, y); + self.overview_corner(i, x, y); if self.screens[i].ui.osd_drag.is_some() { return; } @@ -3255,10 +3285,12 @@ impl App { if g.disable_shell_transparency { c.appearance.transparency.enabled = false; } - c.background.visualiser.enabled = false; + if g.disable_visualizer { + c.background.visualiser.enabled = false; + c.bar.media.show_visualiser = false; + } c.appearance.blur = false; c.appearance.anim.enabled = false; - c.bar.media.show_visualiser = false; } /// The lock screen: swaylock in the shell's colours, over the wallpaper. Not tied to the diff --git a/docs/AUDIT.md b/docs/AUDIT.md index dc64d5c..e8e0391 100644 --- a/docs/AUDIT.md +++ b/docs/AUDIT.md @@ -715,3 +715,9 @@ Migration: per folder, copies files missing in the new one (never overwrites, ne | Catalogues | `shell/translations/caelestia_.ts` | `assets/translations/.tsv` via `tools/ts-to-tsv.py` | 22 languages; `sr` and `vi` left out (nearly empty at a0bc311). Unfinished, plural and `%1` entries skipped. | | Lookup | `qsTr()` per context | `translate::tr`, called in `TextEngine::shape`, `elide`, `wrap` | niri addition: keyed by the English text, contexts ignored (first wins). Any text equal to a source string is translated, including a user's own; dynamic strings (built with `format!`) stay English. | | Language row | `LanguageAndRegion.qml` SelectRow | `general.language`, "System language" follows `$LC_ALL`/`$LANG` | Applied in `units::apply` on every config reload. | + +| Piece | Original | Ours | Notes | +|---|---|---|---| +| Overview hot corners | `Overview` panel, `overview.*` | `wl.rs` `overview_corner`, `config::Overview` | niri addition: the corners run `niri msg action toggle-overview`; the panel and its other rows are left out (D-004). | +| Game mode rows | `GameMode.qml` | `game_mode_shell`, `background.rs` | `disableVisualizer` and `disableDesktopLyrics` now gate those two; the rest stays always off. | +| Screen capture show buttons | no reader outside Nexus | hidden in `add_niri_pages` | Left out: nothing to attach to. | diff --git a/docs/ISSUES.md b/docs/ISSUES.md index 28749fe..3f7b645 100644 --- a/docs/ISSUES.md +++ b/docs/ISSUES.md @@ -163,7 +163,7 @@ From docs/HANDOFF.md "Pick up here" (2026-11-05). The plans split these up. - §4.6 Unported popouts: keyboard layouts, Night Light, Privacy, Greeter (item 10). — keyboard layouts and Night Light fixed S012 (Night Light on wlsunset, a niri addition; its real gamma waits for the user's live check); Privacy and Greeter fixed S013 (Privacy from `pw-dump` woken by the one `pactl subscribe`; the Greeter plays pictures and GIFs, videos left out: no video player) - §4.7 Settings pages left: Network VPN/IPv4, Calendar sources, launcher web search, File Types, list editors (item 11). — Network VPN/IPv4 fixed S015 (VPN import from a WireGuard/OpenVPN file, IPv4 editing; providers left out on purpose); Calendar sources fixed S016 (ICS files and URLs, agenda in the clock popout, Focus follows the calendar §4.3.3); launcher web search and File Types fixed S017 (engine list and File Types are niri additions: the original needs KDE kio and has no File Types); list editors still open - §4.8 Known missing: video wallpapers, widget copy and paste, Escape leaving widget edit mode, Weather/Notes audits, media key rebinding, config path migration (item 12). — open (Weather/Notes audits done in S004: §3.22–§3.25; widget copy and paste, Delete, Ctrl+A and Escape leaving edit mode done in S008, §3.76; video wallpapers done in S014 through mpvpaper, a niri addition) -- §4.9 Dead settings rows: every `shell:` key in `pages.json` without a reader in `crates/` (method in HANDOFF "Testing"). — open +- §4.9 Dead settings rows: every `shell:` key in `pages.json` without a reader in `crates/` (method in HANDOFF "Testing"). — **fixed S020** (test `no_dead_rows`; hot corners toggle niri's overview; game mode's visualiser and lyrics rows read; screen capture show-buttons rows hidden) - §4.10 Bluetooth: the user's iPhone and AirPods sit in the device history, look stuck and cannot pair (user, 2026-11-11). Removing and re-pairing must work. Read-only look (2026-11-17): both are known to BlueZ as `Trusted: yes`, `Paired: no`, `Bonded: no`, and the adapter is `Pairable: no`. The page lists only `devices Paired`, so they showed under "No saved devices" nowhere but the pairing list, with no Forget; and a pairing with the adapter not bondable leaves no bond. — fixed S011 pending the user's live pairing check: the saved list is the bonded devices (as `BluetoothPage.qml`), the pairing list has the rest with their address and a Forget button (niri addition), pairing turns Pairable on first, and a pairing that worked goes back to the list. ## §5 Installer and release diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md index 2f119b6..b0eff9a 100644 --- a/docs/PROGRESS.md +++ b/docs/PROGRESS.md @@ -180,3 +180,7 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done, - Done: original had 24 `.ts` catalogues; 22 flattened to `assets/translations/*.tsv` (`tools/ts-to-tsv.py`), `translate.rs` looks text up at shaping time, Shell language row on the Language page, `general.language` default "system". 3 unit tests written. - Verified: `cargo build --release` only. Not done: tests run, fuzz, snapshots, wrapping check on busy panels (docs/tests/S018). - Limits: strings built with `format!` and Rust-only labels stay English; the original's strings only match where our wording is the same. Later: sr/vi when finished upstream. + +## S020 — Dead rows and overview corners (2026-12-01) +- Done: test `no_dead_rows` lists visible `shell:` rows without a reader; hot corners toggle niri's overview (`overview_corner`, `config::Overview`, Overview page kept with corner rows only); game mode visualiser and lyrics rows read; screen capture show-buttons hidden. +- Verified: build and the new test only. Not done: full tests, fuzz, nested-niri corner check (docs/tests/S020). Later: other rows pass by name match only. diff --git a/docs/tests/S020-dead-rows-overview.md b/docs/tests/S020-dead-rows-overview.md new file mode 100644 index 0000000..56f6f4f --- /dev/null +++ b/docs/tests/S020-dead-rows-overview.md @@ -0,0 +1,33 @@ +# S020 — Dead rows and overview hot corners: test file + +Written by the worker that built it, run by the test phase. Nothing here has been tested until its Result says so. Use a nested niri and a test config copy; never touch the live shell. + +## Built +- `no_dead_rows` test (nexus/mod.rs): every visible `shell:` row needs its snake-case leaf in code (outside `config.rs`, `fuzz.rs`) or the full `shell:` key; `DEAD_OK` lists two rows read through config methods. +- `overview` config struct (enabled, showOnHover, dragThreshold, hoverThickness, four corners); `Wl::overview_corner` runs `niri msg action toggle-overview`. The Overview page stays with only these rows. +- Game mode: `disableVisualizer` and `disableDesktopLyrics` are read now. +- Hidden: Bar screen capture "Show screenshot buttons" and "Show recording buttons" (no reader in the original). + +## Checks +Risk: HIGH = wrong result or lost data · MED = feature broken · LOW = comfort. How: unit · integration · by hand. + +| # | Risk | Do this | Expect | How | Result | +|---|---|---|---|---|---| +| 1 | HIGH | `cargo test --release -p caelestia-shell no_dead_rows` | passes | unit | — | +| 2 | HIGH | `cargo test --release` | all green | unit | — | +| 3 | HIGH | `every_setting` fuzz with a stand-in `secret-tool` on PATH | 0 crashed | integration | — | +| 4 | HIGH | Nested niri, test shell, `overview.showOnHover` true, `hoverTopLeft` true; move pointer into the top-left corner (vptr) | niri overview opens once; staying there does not toggle again | integration | — | +| 5 | MED | Leave the corner and enter again | overview toggles again | integration | — | +| 6 | MED | Other three corners with their toggle off | nothing happens | integration | — | +| 7 | MED | `showOnHover` false, drag from the corner past `dragThreshold` | overview toggles; a short drag does nothing | integration | — | +| 8 | MED | `overview.enabled` false | no corner opens it | integration | — | +| 9 | MED | `--snapshot o.png --nexus PanelsPage` and open Overview | Overview row present; page shows only Activation and Corners rows | integration | — | +| 10 | MED | Game mode on with `disableVisualizer` false | background visualiser stays on; true turns it off | integration | — | +| 11 | MED | Game mode on with `disableDesktopLyrics` false, lyrics playing | desktop lyrics stay; true hides them | integration | — | +| 12 | LOW | Nexus Bar screen capture page | no "Show screenshot buttons" or "Show recording buttons" rows | integration | — | +| 13 | HIGH | Live corner test after the approved restart | as check 4, with the real pointer | by hand (user) | — | + +## Doubts +- Corner size uses `hoverThickness` on the surface size; a bar or border over the corner may block the pointer there. +- Two rows count as read by method name (`DEAD_OK`): check Lock screen wallpaper path and Clock format really change the lock and clocks. +- A name match is not proof of a reader: other rows pass the test by name only and are not shown by snapshot yet.