docs(quick-260929-d37): Desktop-App nur einmal starten
Tessera CI/CD / Lint & Type Check (push) Successful in 51s
Tessera CI/CD / Tests (push) Successful in 1m19s
Tessera CI/CD / Desktop-Pakete bauen (push) Successful in 6m58s
Tessera CI/CD / Build & Publish Images (push) Successful in 3m19s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-29 09:27:27 +02:00
parent 0751198822
commit b9c05791b2
3 changed files with 99 additions and 2 deletions
@@ -0,0 +1,55 @@
---
quick_id: 260929-d37
type: quick
wave: 1
autonomous: true
files_modified:
- apps/desktop/src-tauri/Cargo.toml
- apps/desktop/src-tauri/Cargo.lock
- apps/desktop/src-tauri/src/lib.rs
- CHANGELOG.md
---
# Quick 260929-d37: Desktop-Client nur einmal starten (Single-Instance)
## Problem
User report (29.09.2026, Windows 11): at system start Tessera launches twice and two tray icons appear.
`apps/desktop/src-tauri/src/lib.rs` has no single-instance guard. Autostart via `tauri-plugin-autostart`
(HKCU Run key, only set when the user ticks "Mit Windows starten"); a second launch source (Windows 11
"restart restartable apps after sign-in", a stale Run/Startup entry from an older install, or a manual
double-click) starts a second full process with its own tray icon.
## Goal
Only one Tessera desktop process runs per user session. A second launch hands off to the running one
(show + unminimize + focus the main window) and exits immediately — no second tray icon.
## Task 1: Single-instance plugin
- files: apps/desktop/src-tauri/Cargo.toml, apps/desktop/src-tauri/Cargo.lock, apps/desktop/src-tauri/src/lib.rs
- action:
- Add `tauri-plugin-single-instance = "2"` to `[dependencies]` (resolve with cargo; lockfile updated).
- Register it as the FIRST plugin in `tauri::Builder` (plugin docs require it to be registered first):
`.plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| { focus main window }))`.
- Callback: reuse the exact show/unminimize/set_focus sequence already used by the tray "open" handler
(around lib.rs:820-835). If that sequence is duplicated 3x already, extract a small helper
`fn show_main_window(app: &AppHandle)` and use it in all places (keep behavior identical).
- Short German comment above the plugin line explaining why (double start at Windows sign-in, two tray icons).
- No capabilities/permissions change needed (plugin has no JS API); verify by building.
- verify: `cd apps/desktop/src-tauri && cargo build` succeeds; `cargo test` (existing unit tests) green; `cargo clippy` no new warnings if clippy is available.
- done: builds, tests green, commit `fix(desktop): nur eine Instanz — zweiter Start holt das Fenster nach vorne`.
## Task 2: CHANGELOG
- files: CHANGELOG.md
- action: under `## Unveröffentlicht` add a `### Behoben` section (after `### Neu`) with one plain-German bullet (app text uses "Sie"), e.g.:
"Desktop-App: Tessera startet nicht mehr doppelt. Wird die App ein zweites Mal gestartet – etwa beim Anmelden an Windows –, holt sie nur das vorhandene Fenster nach vorne; im Infobereich erscheint nur noch ein Symbol."
Follow existing CHANGELOG style; run the repo's changelog/umlaut checks if any exist (web tests touching CHANGELOG, e.g. `pnpm --filter web test -- changelog`).
- done: commit `docs(changelog): Desktop-App startet nicht mehr doppelt`.
## Constraints
- Commit locally only. NEVER `git push`.
- Do not touch the desktop version numbers (release process handles them).
- Real Windows verification is not possible from here; state in SUMMARY that the Windows check (VM 8233 or user's PC after next desktop release) is open.
@@ -0,0 +1,41 @@
---
quick_id: 260929-d37
status: complete
commits: 2
plan_head_before: bc26010
plan_head_after: 0751198
---
# Quick 260929-d37: Desktop-Client nur einmal starten (Single-Instance)
`tauri-plugin-single-instance` (2.4.5) ist als erstes Plugin im `tauri::Builder` registriert. Ein zweiter Start holt das Fenster der laufenden Instanz nach vorne und beendet sich, es entsteht kein zweites Tray-Symbol.
## Tasks
1. **Single-Instance-Plugin** — Commit `c0b145a` (`fix(desktop): nur eine Instanz — zweiter Start holt das Fenster nach vorne`)
- `Cargo.toml` und `Cargo.lock` um `tauri-plugin-single-instance = "2"` erweitert.
- Die Sequenz unminimize/show/set_focus stand dreimal in `lib.rs` (Tray "open", "change_server", Tray-Linksklick). Sie ist jetzt der Helper `show_main_window(&AppHandle)`, den auch der Single-Instance-Callback nutzt. Das Verhalten der Tray-Handler ist unverändert. Bei "change_server" läuft `navigate` weiterhin vor dem Anzeigen.
- Kurzer deutscher Kommentar über der Plugin-Zeile.
2. **CHANGELOG** — Commit `0751198` (`docs(changelog): Desktop-App startet nicht mehr doppelt`)
- Unter "Unveröffentlicht" neuer Abschnitt "Behoben" mit einem Eintrag.
## Verifikation
- `cargo build`: ok
- `cargo test`: 44 Tests grün
- `cargo clippy`: keine Warnungen
- Vitest `changelog.test.ts`, `release-notes.test.ts`, `changelog-page.test.tsx`: 33 Tests grün
## Deviations from Plan
None - plan executed exactly as written.
## Offen
Die Prüfung unter Windows steht aus, weil sie von hier aus nicht möglich ist. Sie kann in der Windows-Test-VM 8233 oder auf dem PC des Users nach dem nächsten Desktop-Release erfolgen: App zweimal starten, es darf nur ein Tray-Symbol erscheinen und das Fenster kommt nach vorne. Die Desktop-Versionsnummern sind unverändert.
## Known Stubs
None.
## Self-Check: PASSED