feat(app): keep sharing from the tray when the window closes

The owner wants the shared library to keep running while Chronos runs.
While sharing is on (or on its way), closing the main window now hides it
behind a tray icon (Open Chronos, Exit) instead of ending Chronos. Exit asks
first when clients used the library in the last minutes, then closes the
window for real, so the editor still stores its last edit and the exit path
stops sharing before the other services. A start at sign-in (--minimized)
with sharing on waits in the tray. With sharing off nothing changes.

The decisions live in ShareLifetime (unit-tested); ShellTray wires them to
the window, LibraryShare and OsNotifications, whose balloons reuse the icon.

Server > This library also warns when the 1.0 Windows Server's service
(ChronosServer) is installed, through a read-only SCM P/Invoke probe.

Refs #67

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-15 16:37:00 +01:00
1 parent f30eb2904a
commit 192265f1b7
18 files changed
+502 -6

No files matched your search

+6
View File
@@ -58,6 +58,12 @@ separate Uploader and later updates come through the Uploader's own check.
certificate fingerprint with Copy, the first admin's temporary password (Show, Copy), clients of the last 5
minutes and render nodes online, and Admin panel.
- The admin panel marks the settings Chronos Desktop owns as "Set in Chronos Desktop".
- While sharing, Chronos keeps running in the notification area: closing the window hides it (one notification
says so the first time), the tray icon offers Open Chronos and Exit, and Exit asks first when clients used the
library in the last minutes. Started with Windows while sharing, Chronos waits in the tray instead of on the
taskbar. With sharing off, closing the window exits as before.
- Server › This library warns when the 1.0 Windows Server's service is still installed (it may hold the same
ports; the setup can remove it).
- The owner review 5 request file (`docs/requests/2026-11-15-owner-review-5.md`).
### Changed
+5
View File
@@ -892,3 +892,8 @@ One line per decision: date · decision · alternative · reason.
| 2026-11-15 | While sharing, the job events and the job API expose only kinds clients may see whose first target is the shared archive or one of its sequences; sequence and project events skip sequences of other archives; render nodes never take a render without `CreatedBy` (the desktop's own) or of a sequence the share does not own | Expose every job of the engine | The desktop's engine also runs its workspace and private jobs; clients must not see or take them |
| 2026-11-15 | The desktop counts its share as its own from the moment the hosted server is built, not only once it has started | Only after start | A LAN beacon or a sign-in during the start would otherwise reach itself |
| 2026-11-15 | The Server section reads a job it does not list once, on its first progress event, and lists it if running or paused | Reload the list on unknown progress | A job that started between the list and the event socket stayed hidden until the next reload; one read per job is cheap |
| 2026-11-15 | While sharing, the desktop cancels the main window's close and hides it (tray icon: Open Chronos, Exit); `ShutdownMode` stays `OnMainWindowClose` and Exit closes the window for real, so the editor's save-before-closing handler and the existing exit path (sharing stops first in `AppServices.DisposeAsync`) run unchanged | Switch to `OnExplicitShutdown` while sharing (design §2.5) | A cancelled close never ends the app, so the explicit mode buys nothing; one exit path is simpler to keep right |
| 2026-11-15 | "Sharing" for the tray means served or starting, or on in the settings and not started yet (index opening, archive drive unplugged); a share that failed to start keeps nothing running, and an icon that goes while the window is hidden brings the window back minimised on the taskbar | Tray only while served | A start at sign-in must wait in the tray before the share is up; Chronos must never run out of sight |
| 2026-11-15 | Exit asks first only when the share is on and the programs of the last minutes plus the render nodes online (`LibraryShare.ActiveClientsAsync`, read again at the click) are not 0; Keep sharing is the default | Ask at every Exit while sharing | The question matters only when someone loses the library; the Server section counts clients the same way |
| 2026-11-15 | The "keeps sharing" notification shows once per run, at the first hide; the balloons of unseen toasts go through the same tray icon (`OsNotifications.SharedIcon`) | Once ever (a setting); a second icon for toasts | No new setting for a one-line hint; one icon in the notification area |
| 2026-11-15 | The 1.0 service probe (`ServiceProbe`: `OpenSCManager` connect + `OpenService` query-status P/Invoke) runs when Server › This library opens and at each change of sharing state, shows a warning row whatever the state, and reads access denied as installed | `System.ServiceProcess` (not in the shared framework, a package); probe only after a port failure | Read-only and unelevated; the row is advice before sharing is turned on as much as after a failure |