Files
tessera-ctl/.planning/quick/260929-d37-desktop-client-nur-einmal-starten-single/260929-d37-PLAN.md
T
schalli b9c05791b2
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
docs(quick-260929-d37): Desktop-App nur einmal starten
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 09:27:27 +02:00

56 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
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.