niri: native Sway-style scratchpad (replaces workspace minimize) #2

Closed
funman300 wants to merge 0 commits from feat/niri-scratchpad into main
Owner

Replaces the workspace-based minimize with a native Sway-style scratchpad built into niri, shipped as a patch + Arch package.

What changes

  • niri-patches/0001-scratchpad.patch — the Rust delta (5 commits) on pinned niri v26.04/8ed0da4. Reviewed separately at funman300/niri PR #1.
  • pkg/niri-scratchpad/PKGBUILD — builds pinned niri + applies the patch; provides/conflicts niri; depends matches pacman -Qi niri exactly.
  • niri/config.kdl — removes the workspace "minimized" declaration and the +1 offset; Mod+1..9 -> focus-workspace 1..9; Mod+M -> move-window-to-scratchpad; Mod+Shift+M -> scratchpad-show.
  • install.sh — drops the window-restore symlink; adds an idempotent niri-scratchpad build/install step.
  • Deletes scripts/window-restore.py + its test.

Why

The old minimize used a declared minimized workspace, which niri pins to index 1 — forcing a +1 offset on every Mod+1..9 bind and breaking on multi-monitor. A stash that is not a workspace removes all of that.

Verification

115 layout unit tests pass; live IPC-driven acceptance against a nested patched niri passes (focus-release, show/hide/cycle, geometry-remembered, focus-it branch, close-while-stashed under real SIGKILL). Package builds cleanly producing /usr/bin/niri. Final whole-feature review: ready to merge.

Includes the design spec and implementation plan (docs/superpowers/).

Replaces the workspace-based minimize with a native Sway-style scratchpad built into niri, shipped as a patch + Arch package. ## What changes - `niri-patches/0001-scratchpad.patch` — the Rust delta (5 commits) on pinned niri v26.04/8ed0da4. Reviewed separately at funman300/niri PR #1. - `pkg/niri-scratchpad/PKGBUILD` — builds pinned niri + applies the patch; `provides`/`conflicts` niri; `depends` matches `pacman -Qi niri` exactly. - `niri/config.kdl` — removes the `workspace "minimized"` declaration and the `+1` offset; `Mod+1..9` -> `focus-workspace 1..9`; `Mod+M` -> `move-window-to-scratchpad`; `Mod+Shift+M` -> `scratchpad-show`. - `install.sh` — drops the `window-restore` symlink; adds an idempotent `niri-scratchpad` build/install step. - Deletes `scripts/window-restore.py` + its test. ## Why The old minimize used a declared `minimized` workspace, which niri pins to index 1 — forcing a `+1` offset on every `Mod+1..9` bind and breaking on multi-monitor. A stash that is not a workspace removes all of that. ## Verification 115 layout unit tests pass; live IPC-driven acceptance against a nested patched niri passes (focus-release, show/hide/cycle, geometry-remembered, focus-it branch, close-while-stashed under real SIGKILL). Package builds cleanly producing /usr/bin/niri. Final whole-feature review: ready to merge. Includes the design spec and implementation plan (docs/superpowers/).
funman300 added 3 commits 2026-07-17 19:52:45 +00:00
Design for a Sway-style scratchpad built into niri as a pinned patch set +
niri-scratchpad PKGBUILD. Stores hidden windows in a global stash on Layout
rather than a named workspace, removing the +1 offset and multi-monitor bug.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Seven-task TDD plan: stash fields + move_to_scratchpad, show/cycle state
machine, close-eviction hook, action wiring, patch+PKGBUILD packaging, and
nested-niri manual acceptance. Grounded in niri 26.04 source anchors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the workspace-based minimize (declared 'minimized' workspace +
+1 offset + window-restore.py) with a native Sway-style scratchpad built
into niri. Ships as niri-patches/0001-scratchpad.patch + a niri-scratchpad
PKGBUILD. Mod+M stashes; Mod+Shift+M shows/toggles/cycles. Mod+1..9 no
longer offset.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
funman300 added 1 commit 2026-07-17 20:02:37 +00:00
Refresh the patch with the destroy-path fix (a client dying while stashed is
now evicted instead of leaked/zombied), and add pkg/niri-scratchpad/tests/
acceptance.py: a headless IPC-driven regression test that drives a nested
patched niri and asserts on `niri msg -j windows`. It found the above bug
(unit tests miss it — the harness calls remove_window directly). Run it after
rebasing the patch onto a new niri release.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
funman300 added 1 commit 2026-07-18 17:12:57 +00:00
Adds two synthetic multi-output tests (niri's layout harness supports several
outputs) proving scratchpad_show targets the FOCUSED output, plus a control
that it returns to the origin output when focus is unchanged. This is the
substitute for manual multi-monitor verification on a single-display machine.
117 layout tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
funman300 added 1 commit 2026-07-18 17:46:03 +00:00
Review of the destroy-path fix found two Important defects, both now closed:
a stashed window whose client died never stopped its screencast (leaking a
PipeWire stream/portal session nothing could reclaim), and the unmap path had
the identical hole (a stashed window that unmapped was never reinstated into
unmapped_windows, wedging it permanently on re-map). Also corrects a factually
wrong hook-teardown comment. 117 unit tests and 8/8 live acceptance pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
funman300 added 1 commit 2026-07-18 18:04:15 +00:00
Stashing a window now stops an active screencast of it, rather than leaving the
consumer on a frozen last frame (a stashed window is never rendered). Covers
both stash paths - Mod+M and Mod+Shift+M's hide branch - by diffing which
windows left the layout across the action, so scratchpad_show's branch logic
isn't duplicated in the caller. Dynamic-target casts are retargeted to Nothing
rather than ended; that carve-out is documented inline.

Also widen the acceptance harness spawn wait to 30s: each test launches its own
nested niri, and a cold alacritty start occasionally exceeded the old 10s.
Deliberately not a retry, which could double-spawn and corrupt window counts.

117 unit tests and 8/8 live acceptance pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
funman300 closed this pull request 2026-07-18 23:52:06 +00:00
funman300 deleted branch feat/niri-scratchpad 2026-07-18 23:52:06 +00:00

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/dotfiles#2