niri-desktop-continuity 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- niri_desktop_continuity-0.1.1/.gitignore +19 -0
- niri_desktop_continuity-0.1.1/CHANGELOG.md +70 -0
- niri_desktop_continuity-0.1.1/DESIGN.md +115 -0
- niri_desktop_continuity-0.1.1/Justfile +50 -0
- niri_desktop_continuity-0.1.1/LICENSE +73 -0
- niri_desktop_continuity-0.1.1/PKG-INFO +195 -0
- niri_desktop_continuity-0.1.1/README.md +178 -0
- niri_desktop_continuity-0.1.1/docs/architecture.md +123 -0
- niri_desktop_continuity-0.1.1/docs/project/2026-09-06-integrated-reconstruction-design.md +324 -0
- niri_desktop_continuity-0.1.1/docs/project/2026-09-06-integrated-reconstruction-plan.md +212 -0
- niri_desktop_continuity-0.1.1/docs/project/2026-09-06-integrated-reconstruction-protocol.md +752 -0
- niri_desktop_continuity-0.1.1/docs/recovery.md +79 -0
- niri_desktop_continuity-0.1.1/docs/usage.md +344 -0
- niri_desktop_continuity-0.1.1/pyproject.toml +65 -0
- niri_desktop_continuity-0.1.1/scripts/.gitkeep +1 -0
- niri_desktop_continuity-0.1.1/scripts/check-portability.py +142 -0
- niri_desktop_continuity-0.1.1/scripts/ci/fast.sh +7 -0
- niri_desktop_continuity-0.1.1/scripts/ci/full.sh +6 -0
- niri_desktop_continuity-0.1.1/scripts/ci/package-smoke.py +295 -0
- niri_desktop_continuity-0.1.1/scripts/ci/smoke.sh +5 -0
- niri_desktop_continuity-0.1.1/scripts/demo-desktop.py +265 -0
- niri_desktop_continuity-0.1.1/scripts/docs-screenshots.sh +20 -0
- niri_desktop_continuity-0.1.1/src/.gitkeep +1 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/__init__.py +3 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/__main__.py +5 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/approval.py +56 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/assets/tokens.css +51 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/autostart.py +125 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/cli.py +354 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/launch.py +460 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/map_preview.py +467 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/model.py +255 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/operation_lock.py +45 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/planner.py +279 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/probe.py +240 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/reconcile.py +179 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/recovery.py +451 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/recovery_adapter.py +198 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/recovery_additive.py +265 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/recovery_diagnostics.py +87 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/recovery_ledger.py +264 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/recovery_profile.py +198 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/recovery_projection.py +63 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/recovery_protocol.py +286 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/recovery_requests.py +117 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/recovery_resolution.py +245 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/recovery_transition.py +208 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/recovery_utilities.py +111 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/recovery_verification.py +57 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/resolution_candidate.py +315 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/resolution_cli.py +90 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/resolution_evidence.py +387 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/resolution_graph.py +376 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/resolution_io.py +144 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/resolution_lock.py +60 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/resolution_observer.py +79 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/resolution_worker_history.py +294 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/resolution_worker_history_completed.py +238 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/resolution_worker_history_fixture.py +156 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/resolution_worker_history_native.py +140 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/resolution_worker_history_schema.py +339 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/restore.py +374 -0
- niri_desktop_continuity-0.1.1/src/niri_desktop_continuity/store.py +196 -0
- niri_desktop_continuity-0.1.1/tests/.gitkeep +1 -0
- niri_desktop_continuity-0.1.1/tests/conftest.py +20 -0
- niri_desktop_continuity-0.1.1/tests/test_core.py +515 -0
- niri_desktop_continuity-0.1.1/tests/test_map.py +234 -0
- niri_desktop_continuity-0.1.1/tests/test_portability.py +343 -0
- niri_desktop_continuity-0.1.1/tests/test_portability_packages.py +162 -0
- niri_desktop_continuity-0.1.1/tests/test_recovery_adapter_deadlines.py +187 -0
- niri_desktop_continuity-0.1.1/tests/test_recovery_backend.py +583 -0
- niri_desktop_continuity-0.1.1/tests/test_recovery_execute_faults.py +112 -0
- niri_desktop_continuity-0.1.1/tests/test_recovery_hardening.py +243 -0
- niri_desktop_continuity-0.1.1/tests/test_recovery_multitool.py +250 -0
- niri_desktop_continuity-0.1.1/tests/test_recovery_orchestration.py +424 -0
- niri_desktop_continuity-0.1.1/tests/test_recovery_pending_heartbeat.py +104 -0
- niri_desktop_continuity-0.1.1/tests/test_recovery_residuals.py +135 -0
- niri_desktop_continuity-0.1.1/tests/test_recovery_review_regressions.py +89 -0
- niri_desktop_continuity-0.1.1/tests/test_recovery_utilities.py +367 -0
- niri_desktop_continuity-0.1.1/tests/test_reopen.py +838 -0
- niri_desktop_continuity-0.1.1/tests/test_resolution.py +474 -0
- niri_desktop_continuity-0.1.1/tests/test_resolution_completed_history.py +407 -0
- niri_desktop_continuity-0.1.1/tests/test_resolution_coverage.py +121 -0
- niri_desktop_continuity-0.1.1/tests/test_resolution_direct.py +195 -0
- niri_desktop_continuity-0.1.1/tests/test_resolution_fixtures.py +303 -0
- niri_desktop_continuity-0.1.1/tests/test_resolution_history_fixtures.py +350 -0
- niri_desktop_continuity-0.1.1/tests/test_resolution_transport.py +182 -0
- niri_desktop_continuity-0.1.1/tests/test_resolution_verification.py +165 -0
- niri_desktop_continuity-0.1.1/tests/test_resolution_worker_history.py +369 -0
- niri_desktop_continuity-0.1.1/tests/test_saved_reopen.py +291 -0
- niri_desktop_continuity-0.1.1/tests/test_saved_reopen_backend.py +250 -0
- niri_desktop_continuity-0.1.1/tests/test_saved_reopen_hardening.py +130 -0
- niri_desktop_continuity-0.1.1/tests/test_saved_reopen_installed.py +181 -0
- niri_desktop_continuity-0.1.1/tests/test_saved_reopen_preview.py +105 -0
- niri_desktop_continuity-0.1.1/tests/test_saved_reopen_projection_history.py +123 -0
- niri_desktop_continuity-0.1.1/tests/test_saved_reopen_projections.py +242 -0
- niri_desktop_continuity-0.1.1/uv.lock +112 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.venv/
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
.pytest_cache/
|
|
5
|
+
.ruff_cache/
|
|
6
|
+
*.egg-info/
|
|
7
|
+
/dist/
|
|
8
|
+
/build/
|
|
9
|
+
/state/
|
|
10
|
+
/snapshots/
|
|
11
|
+
/previews/
|
|
12
|
+
/receipts/
|
|
13
|
+
/artifacts/
|
|
14
|
+
# Optional workspace-local SCI development state; never a source or package input.
|
|
15
|
+
/.ontology/
|
|
16
|
+
# Generated immutable local template context; not part of the standalone repository.
|
|
17
|
+
/docs/_core/
|
|
18
|
+
# Generated index, never hand-authored.
|
|
19
|
+
/docs/diary-index.md
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
User-facing changes per release. Versions follow [semantic versioning](https://semver.org);
|
|
4
|
+
before 1.0, a minor release may change CLI output or saved-state formats, and its entry says how.
|
|
5
|
+
The release process is in [docs/release.md](docs/release.md).
|
|
6
|
+
|
|
7
|
+
## [0.1.1] - 2026-09-19
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Terminal sessions are read only in Ghostty, by design. Other terminals (kitty, WezTerm, foot,
|
|
12
|
+
Alacritty) now reopen as plain applications with their own command line, instead of receiving
|
|
13
|
+
Ghostty's `--working-directory` and `-e`, which they do not accept. Captures made by 0.1.0 keep
|
|
14
|
+
their old recipes until the next `capture`.
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- On PyPI: `pipx install niri-desktop-continuity`. Each release is built once in CI from its tag,
|
|
19
|
+
attached to the GitHub Release with `SHA256SUMS` and uploaded to PyPI through trusted publishing.
|
|
20
|
+
- README links and images are absolute, so the page reads the same on PyPI.
|
|
21
|
+
|
|
22
|
+
## [0.1.0] - 2026-09-19
|
|
23
|
+
|
|
24
|
+
First public release. Alpha, for [niri](https://github.com/YaLTeR/niri) on Linux, Python 3.11+,
|
|
25
|
+
no runtime dependencies. Install from the release wheel or with
|
|
26
|
+
`pipx install git+https://github.com/tryingET/niri-desktop-continuity@v0.1.0`.
|
|
27
|
+
|
|
28
|
+
### Save and reopen your desktop
|
|
29
|
+
|
|
30
|
+
- `capture` saves windows, workspaces, column layout and a private reopen recipe per window:
|
|
31
|
+
a Claude Code session (resumed by id), a Pi session, an application command line and working
|
|
32
|
+
directory, a terminal's last command, a shell in the same directory, or a command you gave
|
|
33
|
+
`declare`. Anything else is recorded as `unknown` with a reason.
|
|
34
|
+
- `restore` prints the placement plan; `restore --apply` launches each recipe through niri, puts
|
|
35
|
+
the window on its saved workspace, rebuilds the saved column order and widths and re-applies
|
|
36
|
+
workspace names. Windows open before the run are never moved or closed; every run leaves a
|
|
37
|
+
receipt. Browsers, Thunderbird and Obsidian are launched once and restore their own windows.
|
|
38
|
+
- `autostart --enable` adds opt-in systemd user units: a capture every 15 minutes and a reopen at
|
|
39
|
+
login when the capture came from a different niri instance. `--disable` removes them.
|
|
40
|
+
- `declare --pid PID -- COMMAND` reopens a terminal session that cannot be resumed as a fresh
|
|
41
|
+
command, for example a new session started from a handoff note.
|
|
42
|
+
- Applications restart in their saved working directory. Chromium and Electron command lines,
|
|
43
|
+
which those programs rewrite into one process title, are split at a real program file.
|
|
44
|
+
|
|
45
|
+
### Check before you restart
|
|
46
|
+
|
|
47
|
+
- `preview` writes an offline HTML/SVG map of the latest capture (or a given digest). Every tile
|
|
48
|
+
says how the window comes back, and an **After a reboot** section lists each window's kind,
|
|
49
|
+
exact command and directory, or why it will not reopen.
|
|
50
|
+
|
|
51
|
+
### Safety and privacy
|
|
52
|
+
|
|
53
|
+
- A Claude process without a session registry entry is never replayed from its command line.
|
|
54
|
+
X11 windows (`xwayland-client`) and unresolvable AppImage mounts are reported, not guessed.
|
|
55
|
+
- State is private (`0700`/`0600`); window titles and session titles are stored only with
|
|
56
|
+
`capture --include-titles`. No network requests, telemetry or daemon; discovered binaries are
|
|
57
|
+
hashed, never executed.
|
|
58
|
+
|
|
59
|
+
### Also included, experimental
|
|
60
|
+
|
|
61
|
+
- Blocked restart proposals, a single-column reorder with exact approvals, and loss-bounded
|
|
62
|
+
reconstruction and resolution lifecycles that need a separately owned adapter (none ships
|
|
63
|
+
here). See [docs/recovery.md](docs/recovery.md).
|
|
64
|
+
|
|
65
|
+
### Known limits
|
|
66
|
+
|
|
67
|
+
- Reopening is not restoring memory: unsaved drafts, scrollback and hidden tab order are lost.
|
|
68
|
+
- X11 applications are not reopened. Placement is by workspace index; the monitor is not restored.
|
|
69
|
+
- Arguments that contained spaces cannot be recovered from a rewritten process title.
|
|
70
|
+
- Stay idle while `restore --apply` arranges columns; niri has no atomic focus-and-move.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Offline incident-map design contract for desktop continuity; review is not restart permission."
|
|
3
|
+
read_when:
|
|
4
|
+
- "You edit the isolated desktop-continuity map_preview renderer."
|
|
5
|
+
version: alpha
|
|
6
|
+
name: Niri Desktop Continuity
|
|
7
|
+
description: A private offline map of the work that must survive maintenance.
|
|
8
|
+
colors:
|
|
9
|
+
primary: "#D9E5DA"
|
|
10
|
+
secondary: "#A8BAB5"
|
|
11
|
+
tertiary: "#F5C875"
|
|
12
|
+
neutral: "#101D22"
|
|
13
|
+
surface: "#192C32"
|
|
14
|
+
on-surface: "#EAF0E8"
|
|
15
|
+
muted: "#456268"
|
|
16
|
+
success: "#8ED7C3"
|
|
17
|
+
warning: "#F5C875"
|
|
18
|
+
error: "#FFAF9F"
|
|
19
|
+
typography:
|
|
20
|
+
display:
|
|
21
|
+
fontFamily: Georgia, serif
|
|
22
|
+
fontSize: 48px
|
|
23
|
+
fontWeight: 400
|
|
24
|
+
lineHeight: 1.1
|
|
25
|
+
h1:
|
|
26
|
+
fontFamily: Georgia, serif
|
|
27
|
+
fontSize: 32px
|
|
28
|
+
fontWeight: 400
|
|
29
|
+
lineHeight: 1.2
|
|
30
|
+
body-md:
|
|
31
|
+
fontFamily: "DejaVu Sans", sans-serif
|
|
32
|
+
fontSize: 16px
|
|
33
|
+
fontWeight: 400
|
|
34
|
+
lineHeight: 1.5
|
|
35
|
+
label-caps:
|
|
36
|
+
fontFamily: "DejaVu Sans Mono", monospace
|
|
37
|
+
fontSize: 12px
|
|
38
|
+
fontWeight: 400
|
|
39
|
+
lineHeight: 1.4
|
|
40
|
+
rounded:
|
|
41
|
+
sm: 4px
|
|
42
|
+
md: 8px
|
|
43
|
+
spacing:
|
|
44
|
+
xs: 4px
|
|
45
|
+
sm: 8px
|
|
46
|
+
md: 16px
|
|
47
|
+
lg: 24px
|
|
48
|
+
xl: 40px
|
|
49
|
+
components:
|
|
50
|
+
card:
|
|
51
|
+
backgroundColor: "{colors.surface}"
|
|
52
|
+
textColor: "{colors.on-surface}"
|
|
53
|
+
rounded: "{rounded.sm}"
|
|
54
|
+
padding: 16px
|
|
55
|
+
alert-warning:
|
|
56
|
+
backgroundColor: "{colors.neutral}"
|
|
57
|
+
textColor: "{colors.warning}"
|
|
58
|
+
padding: 16px
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Overview
|
|
62
|
+
|
|
63
|
+
Niri Desktop Continuity is a night-chart of the operator's mental workspace. It is a review artifact,
|
|
64
|
+
not a live remote-control panel and not a backup of process memory. No network resources,
|
|
65
|
+
JavaScript, thumbnails, terminal output, browser contents, or executable approval buttons.
|
|
66
|
+
|
|
67
|
+
## Visual direction
|
|
68
|
+
|
|
69
|
+
Surveyor's ledger: ink-blue drafting surface, pale mineral text, amber admission warnings.
|
|
70
|
+
Serif headings frame a precise monospaced map. Workspace rows preserve vertical order;
|
|
71
|
+
columns run horizontally with tiles grouped inside them. Floating windows have a separate row.
|
|
72
|
+
|
|
73
|
+
## Colors
|
|
74
|
+
|
|
75
|
+
Use the front-matter palette. Amber always means caution, not successful recovery. Teal may
|
|
76
|
+
mark selected scope or a measured predicate, never unverified application state.
|
|
77
|
+
|
|
78
|
+
## Typography
|
|
79
|
+
|
|
80
|
+
Georgia headlines, DejaVu Sans body, DejaVu Sans Mono coordinates and identifiers. Local font
|
|
81
|
+
fallbacks only. Full identifiers remain available as text even if a compact tile label truncates.
|
|
82
|
+
|
|
83
|
+
## Layout
|
|
84
|
+
|
|
85
|
+
Read top to bottom: capture timestamp and privacy; admission warning; current map; desired map
|
|
86
|
+
when supplied, otherwise the after-reboot reopen ledger; process/version/scope ledger; limitations. Horizontal overflow is explicit, not
|
|
87
|
+
silently dropped. SVG is a schematic, not a screenshot or pixel-perfect viewport reconstruction.
|
|
88
|
+
|
|
89
|
+
## Elevation and Depth
|
|
90
|
+
|
|
91
|
+
Thin drafting borders, generous gutters, no shadows or gradients. Stable static output is more
|
|
92
|
+
important than animation during a recovery incident.
|
|
93
|
+
|
|
94
|
+
## Shapes
|
|
95
|
+
|
|
96
|
+
Small-radius cards and square coordinate labels. No decorative circular gauges.
|
|
97
|
+
|
|
98
|
+
## Components
|
|
99
|
+
|
|
100
|
+
A workspace header gives stable ID, current index, output and window count. Column headers
|
|
101
|
+
show position, not guessed application tab state. Admission has text status plus blockers;
|
|
102
|
+
status must not rely on color. HTML has a full private inventory; SVG includes every window.
|
|
103
|
+
On snapshot previews each tile states its reopen outcome in text (`reopens as <kind>` or
|
|
104
|
+
`not reopened (<reason>)`), and the after-reboot ledger lists every window and tab session with
|
|
105
|
+
a count summary, the exact recorded command and a plain-language reason for each miss. A miss is
|
|
106
|
+
amber (caution); a reopen is plain text, never teal, because a recipe is not verified state.
|
|
107
|
+
|
|
108
|
+
## Do's and Don'ts
|
|
109
|
+
|
|
110
|
+
- Do HTML/XML-escape all observed strings and remove invalid XML control characters.
|
|
111
|
+
- Do preserve exact digests in the textual approval panel.
|
|
112
|
+
- Do label unavailable geometry, versions, output readiness and native state as unknown.
|
|
113
|
+
- Do default to redacted window labels; included titles remain private local data.
|
|
114
|
+
- Don't infer hidden Ghostty tabs from compositor windows or title heuristics.
|
|
115
|
+
- Don't auto-open the operator's browser or restart any process.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Standardized operator surface for this standalone CLI.
|
|
2
|
+
# Thin delegation to repo-local wrappers; see scripts/ci/ and docs/engineering.local.md.
|
|
3
|
+
|
|
4
|
+
default: help
|
|
5
|
+
|
|
6
|
+
# Show the supported local command surface.
|
|
7
|
+
help:
|
|
8
|
+
just --list
|
|
9
|
+
|
|
10
|
+
# Run the default test suite (pytest; config lives in pyproject.toml).
|
|
11
|
+
test:
|
|
12
|
+
uv run --frozen pytest
|
|
13
|
+
|
|
14
|
+
# Fast local validation gate: lint, formatting check, tests, entrypoint smoke,
|
|
15
|
+
# and the portable-source/privacy check. Delegates to the canonical wrapper.
|
|
16
|
+
check:
|
|
17
|
+
./scripts/ci/fast.sh
|
|
18
|
+
|
|
19
|
+
# Non-formatting linter over the same scope as the check gate.
|
|
20
|
+
lint:
|
|
21
|
+
uv run --frozen ruff check src tests scripts/check-portability.py scripts/ci/package-smoke.py scripts/demo-desktop.py
|
|
22
|
+
|
|
23
|
+
# Apply formatting to the same scope as the check gate.
|
|
24
|
+
fmt:
|
|
25
|
+
uv run --frozen ruff format src tests scripts/check-portability.py scripts/ci/package-smoke.py scripts/demo-desktop.py
|
|
26
|
+
|
|
27
|
+
# Build distributable artifacts (wheel + sdist).
|
|
28
|
+
build:
|
|
29
|
+
uv build
|
|
30
|
+
|
|
31
|
+
# Full local CI-equivalent gate: check + package build via the canonical wrapper.
|
|
32
|
+
# scripts/ci/full.sh already runs fast.sh, so ci must not also invoke check.
|
|
33
|
+
ci:
|
|
34
|
+
./scripts/ci/full.sh
|
|
35
|
+
|
|
36
|
+
# Toolchain/runtime sanity checks: uv present, locked environment, interpreter.
|
|
37
|
+
doctor:
|
|
38
|
+
uv --version
|
|
39
|
+
uv run --frozen python --version
|
|
40
|
+
|
|
41
|
+
# One-shot execution of the primary CLI entrypoint (truthful --help smoke).
|
|
42
|
+
run:
|
|
43
|
+
uv run --frozen niri-desktop-continuity --help
|
|
44
|
+
|
|
45
|
+
# Re-render the README screenshots from the fabricated demo desktop (needs chromium + ImageMagick).
|
|
46
|
+
screenshots:
|
|
47
|
+
./scripts/docs-screenshots.sh
|
|
48
|
+
|
|
49
|
+
# NOTE: no `dev` target: this repo has no long-running dev/watch surface
|
|
50
|
+
# (standard-library CLI; iteration is edit + `just run`/`just test`).
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
12
|
+
|
|
13
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
14
|
+
|
|
15
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
16
|
+
|
|
17
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
18
|
+
|
|
19
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
20
|
+
|
|
21
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
22
|
+
|
|
23
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
24
|
+
|
|
25
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
26
|
+
|
|
27
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
28
|
+
|
|
29
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
30
|
+
|
|
31
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
32
|
+
|
|
33
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
34
|
+
|
|
35
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
36
|
+
|
|
37
|
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
38
|
+
|
|
39
|
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
40
|
+
|
|
41
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
42
|
+
|
|
43
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
44
|
+
|
|
45
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
46
|
+
|
|
47
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
48
|
+
|
|
49
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
50
|
+
|
|
51
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
52
|
+
|
|
53
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
54
|
+
|
|
55
|
+
END OF TERMS AND CONDITIONS
|
|
56
|
+
|
|
57
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
58
|
+
|
|
59
|
+
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
|
60
|
+
|
|
61
|
+
Copyright [yyyy] [name of copyright owner]
|
|
62
|
+
|
|
63
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
64
|
+
you may not use this file except in compliance with the License.
|
|
65
|
+
You may obtain a copy of the License at
|
|
66
|
+
|
|
67
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
68
|
+
|
|
69
|
+
Unless required by applicable law or agreed to in writing, software
|
|
70
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
71
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
72
|
+
See the License for the specific language governing permissions and
|
|
73
|
+
limitations under the License.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: niri-desktop-continuity
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Save your niri desktop and reopen it after a reboot: windows on their workspaces, in column order
|
|
5
|
+
Project-URL: Homepage, https://github.com/tryingET/niri-desktop-continuity
|
|
6
|
+
Project-URL: Issues, https://github.com/tryingET/niri-desktop-continuity/issues
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: desktop,niri,reboot,restore,session,wayland
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Desktop Environment
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# niri-desktop-continuity
|
|
19
|
+
|
|
20
|
+
[](https://github.com/tryingET/niri-desktop-continuity/actions/workflows/ci.yml)
|
|
21
|
+
[](https://pypi.org/project/niri-desktop-continuity/)
|
|
22
|
+
[](https://github.com/tryingET/niri-desktop-continuity/blob/main/LICENSE)
|
|
23
|
+
|
|
24
|
+
**Reboot, log in, and your [niri](https://github.com/YaLTeR/niri) desktop comes back.** Windows
|
|
25
|
+
reopen on their workspaces in their column order, Claude Code and Pi sessions resume by id, and
|
|
26
|
+
anything that cannot be reopened safely is reported, never guessed.
|
|
27
|
+
|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
<sub>The offline preview page for a fabricated demo desktop (not anyone's real one): the first two
|
|
31
|
+
of its five workspaces, 23 windows in all. Every tile says how it comes back after a reboot, or
|
|
32
|
+
why it will not.</sub>
|
|
33
|
+
|
|
34
|
+
## Why
|
|
35
|
+
|
|
36
|
+
niri's scrolling columns make it easy to build a desktop that is worth keeping: a workspace per
|
|
37
|
+
project, terminals running agents and dev servers, a browser and notes beside them. A reboot or a
|
|
38
|
+
crash throws all of it away, and rebuilding it by hand, window by window and column by column, takes
|
|
39
|
+
longer than the reboot did.
|
|
40
|
+
|
|
41
|
+
This small tool saves the shape of your desktop every 15 minutes and, at your next login, puts it
|
|
42
|
+
back. From a real reboot of the maintainer's desktop:
|
|
43
|
+
|
|
44
|
+
- **26 windows saved, 25 reopened at login in 49 seconds**, every one on its saved workspace in
|
|
45
|
+
its saved column order.
|
|
46
|
+
- Claude Code and Pi sessions **resumed by id**.
|
|
47
|
+
- Two sessions that could not be resumed came back as **fresh sessions started from their handoff
|
|
48
|
+
notes** (`declare`), instead of replaying their opening prompts.
|
|
49
|
+
- The one miss, an X11 app, was **reported in the receipt, not guessed**.
|
|
50
|
+
|
|
51
|
+
## Quickstart
|
|
52
|
+
|
|
53
|
+
Requires Linux, niri and Python 3.11+, with [Ghostty](https://ghostty.org) as your terminal. No
|
|
54
|
+
runtime dependencies.
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
pipx install niri-desktop-continuity
|
|
58
|
+
# or: uv tool install niri-desktop-continuity
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Every release is also on [GitHub Releases](https://github.com/tryingET/niri-desktop-continuity/releases)
|
|
62
|
+
with checksums; what changed is in the [changelog](https://github.com/tryingET/niri-desktop-continuity/blob/main/CHANGELOG.md).
|
|
63
|
+
|
|
64
|
+
Save your desktop and check what would come back:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
niri-desktop-continuity capture # save windows, workspaces and a reopen recipe per window
|
|
68
|
+
niri-desktop-continuity preview # write an offline HTML map of the latest capture; open the printed path
|
|
69
|
+
niri-desktop-continuity restore # dry run: the placement plan, as JSON; nothing is launched
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Reopen it: automatically at every login, or by hand after a reboot or crash:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
niri-desktop-continuity autostart --enable # capture every 15 min, reopen at login; --disable removes it
|
|
76
|
+
niri-desktop-continuity restore --apply # reopen the latest capture now
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`restore --apply` launches every reopenable saved window that is not already open as a Claude or
|
|
80
|
+
Pi session, so run it on a desktop that has lost those windows. In the session you just captured,
|
|
81
|
+
it would open second copies. The login service checks this for you: it reopens only when the
|
|
82
|
+
capture came from a different niri instance, such as the one before a reboot.
|
|
83
|
+
|
|
84
|
+
A session that cannot be resumed (for example, a Claude Code session started from inside another
|
|
85
|
+
one, which keeps no transcript) is not reopened. If you would rather it came back as a fresh
|
|
86
|
+
session, say so while it is still running:
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
niri-desktop-continuity declare --pid <pid> -- claude "Continue from docs/handoff.md"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`<pid>` is any process in that terminal (for example from `pgrep -a claude`). The declaration
|
|
93
|
+
lives until the next reboot, applies only to that exact process, and `declare --pid <pid> --clear`
|
|
94
|
+
removes it.
|
|
95
|
+
|
|
96
|
+
## Check before you restart
|
|
97
|
+
|
|
98
|
+
`preview` writes a standalone HTML page and prints its path. Its **After a reboot** section lists
|
|
99
|
+
every saved window: whether it reopens, as what, with the exact command and directory, or why it
|
|
100
|
+
will not.
|
|
101
|
+
|
|
102
|
+

|
|
103
|
+
|
|
104
|
+
<sub>Same fabricated demo desktop, first workspace's rows. `restore` prints the same plan as
|
|
105
|
+
JSON.</sub>
|
|
106
|
+
|
|
107
|
+
## How it works
|
|
108
|
+
|
|
109
|
+
Each `capture` reads niri's IPC and same-user process metadata, and records a private *reopen
|
|
110
|
+
recipe* per window:
|
|
111
|
+
|
|
112
|
+
| Kind | How it comes back |
|
|
113
|
+
|---|---|
|
|
114
|
+
| `claude` | Ghostty, running `claude --resume <id>` in the session's directory (from Claude Code's per-process session registry) |
|
|
115
|
+
| `pi` | Ghostty, running Pi's own resume command (from Pi's presence directory) |
|
|
116
|
+
| `declared` | Ghostty, running the command you gave `declare` |
|
|
117
|
+
| `app` | the application's command line and working directory |
|
|
118
|
+
| `command` | Ghostty, running its last command again (for example `btop` or `npm run dev`) |
|
|
119
|
+
| `shell` | Ghostty, opened in the same directory |
|
|
120
|
+
| `unknown` | not reopened. The reason is recorded, for example `xwayland-client` or `claude-session-unregistered` |
|
|
121
|
+
|
|
122
|
+
`restore --apply` spawns each recipe through niri, waits for its window, moves it to its workspace,
|
|
123
|
+
then rebuilds the saved column order and widths and re-applies workspace names. Browsers,
|
|
124
|
+
Thunderbird and Obsidian restore their own windows, so they are launched once. Every run writes a
|
|
125
|
+
receipt (`history --kind receipts`); exit status 2 means a partial or interrupted run.
|
|
126
|
+
Details: [usage](https://github.com/tryingET/niri-desktop-continuity/blob/main/docs/usage.md#save-and-reopen).
|
|
127
|
+
|
|
128
|
+
## What it never does
|
|
129
|
+
|
|
130
|
+
- **Never closes a window, and never moves one that was open before the run.** Reopened columns
|
|
131
|
+
go after them.
|
|
132
|
+
- **Never replays what it cannot resume.** A Claude process without a session registry entry is
|
|
133
|
+
not relaunched from its command line, which would start the same work over.
|
|
134
|
+
- **Never guesses.** An X11 window (niri reports only the `xwayland-satellite` bridge), an
|
|
135
|
+
unresolvable AppImage mount or an unreadable process is reported with a reason, not launched.
|
|
136
|
+
- **Never runs anything at login unless you opt in.** `autostart --enable` writes three systemd user
|
|
137
|
+
units, `--disable` removes them. Nothing else installs a service or edits your configuration.
|
|
138
|
+
- **Never executes a discovered binary while capturing.** Executables are hashed, not run.
|
|
139
|
+
- **Makes no network requests of its own.** No telemetry, no daemon. The preview is static HTML
|
|
140
|
+
with no scripts or remote assets, and no browser is launched for you.
|
|
141
|
+
- **Never reads terminal contents or browser profiles.** Session ids come from Claude Code's
|
|
142
|
+
session registry and Pi's presence files. From a Claude Code transcript it takes only the
|
|
143
|
+
session title, to tell apart windows of one terminal process.
|
|
144
|
+
|
|
145
|
+
Records stay private: `0700` directories and `0600` files under
|
|
146
|
+
`$XDG_STATE_HOME/niri-desktop-continuity` (default `~/.local/state/niri-desktop-continuity`, or
|
|
147
|
+
`--state-root <dir>`). Window titles and session titles are redacted unless you
|
|
148
|
+
`capture --include-titles`. Recipes still contain command lines and working directories, so treat
|
|
149
|
+
captures and previews as private and do not publish them.
|
|
150
|
+
|
|
151
|
+
## Honest limits
|
|
152
|
+
|
|
153
|
+
- **niri on Linux only.** No other compositor or platform is planned. Alpha software.
|
|
154
|
+
- **Reopening is not restoring memory.** Applications bring back their own content. Unsaved drafts,
|
|
155
|
+
scrollback, shell state and the order of hidden tabs are not recovered.
|
|
156
|
+
- **X11 applications are not reopened**, because niri does not reveal which X11 program owns a
|
|
157
|
+
window.
|
|
158
|
+
- **Ghostty only, by design.** Sessions inside terminals are read and resumed in Ghostty. Other
|
|
159
|
+
terminals (kitty, WezTerm, foot, Alacritty) reopen as plain applications, without what ran in
|
|
160
|
+
them; if you use one, fork it. Claude Code and Pi resume by id; other programs in Ghostty get
|
|
161
|
+
their last command run again, or a shell in the same directory. Sessions found in extra tabs of
|
|
162
|
+
one Ghostty window reopen as separate windows.
|
|
163
|
+
- **Placement is by workspace index.** Saved workspaces are compacted to consecutive indices, and
|
|
164
|
+
which monitor a workspace was on is not restored.
|
|
165
|
+
- **Stay idle while it arranges columns** (usually under a minute). niri has no atomic
|
|
166
|
+
focus-and-move, so input during the run can land in the wrong column.
|
|
167
|
+
- Exact restart or migration of a still-running window is **not** supported and stays blocked.
|
|
168
|
+
|
|
169
|
+
## Beyond reopening
|
|
170
|
+
|
|
171
|
+
The same CLI also plans blocked restart proposals and has a loss-bounded saved-conversation
|
|
172
|
+
reconstruction path, which needs a separately owned adapter that does not ship here. It also has
|
|
173
|
+
an experimental single-column reorder. None of these is needed to save and reopen a desktop. See
|
|
174
|
+
[planning, reconstruction and resolution](https://github.com/tryingET/niri-desktop-continuity/blob/main/docs/recovery.md).
|
|
175
|
+
|
|
176
|
+
## Develop
|
|
177
|
+
|
|
178
|
+
```sh
|
|
179
|
+
uv sync --group dev
|
|
180
|
+
just check # lint, formatting, tests, portable-source/privacy check
|
|
181
|
+
just build # wheel + sdist
|
|
182
|
+
just ci # check + build
|
|
183
|
+
just screenshots # re-render docs/assets from the fabricated demo desktop (Chromium + ImageMagick)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Tests never contact a real compositor; [releasing](https://github.com/tryingET/niri-desktop-continuity/blob/main/docs/release.md) describes versions, tags and
|
|
187
|
+
rollback. [Architecture](https://github.com/tryingET/niri-desktop-continuity/blob/main/docs/architecture.md) explains the module
|
|
188
|
+
boundaries, [DESIGN.md](https://github.com/tryingET/niri-desktop-continuity/blob/main/DESIGN.md) is the preview's visual contract and [usage](https://github.com/tryingET/niri-desktop-continuity/blob/main/docs/usage.md) has
|
|
189
|
+
every command's details. Screenshots come only from `scripts/demo-desktop.py`, and
|
|
190
|
+
`just check` refuses PNG metadata that could carry private text.
|
|
191
|
+
|
|
192
|
+
Scaffolded from `tpl-project-repo`, then adapted for a standalone Python package. Copier answers
|
|
193
|
+
retain relative template provenance only; template updates are a maintainer concern, not an
|
|
194
|
+
installation prerequisite. Private template snapshot context is excluded from version control
|
|
195
|
+
and distribution. Apache-2.0: see [LICENSE](https://github.com/tryingET/niri-desktop-continuity/blob/main/LICENSE).
|