You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add single-instance control and multi-instance window cascading
- New `allow_only_one_instance` config option: "off" (multiple allowed),
"on"/"first" (bring existing to foreground and exit), "last" (kill existing)
- Multi-instance cascade: each new instance offsets +32px from siblings
- "first" mode activates existing window (restores from minimized if needed)
- Skip saving window state when minimized (prevents -32000 coordinates)
- Update README with single-instance documentation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+19-3Lines changed: 19 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ A lightweight [Tauri v2](https://v2.tauri.app/) desktop app that wraps any websi
11
11
-**Dark mode control** — Request dark/light theme from sites, or force-dark all sites (Windows)
12
12
-**Remember window position** — Window size, position, and maximized state are saved and restored across sessions
13
13
-**Start minimized** — Optionally launch the app minimized to the taskbar
14
+
-**Single-instance control** — Prevent multiple instances, or let the latest instance take over (Windows)
14
15
-**Rename-to-configure** — Rename the executable and it auto-detects its config file (`MyApp.exe` → `MyApp.json`)
15
16
-**Cross-platform** — Builds for Windows x64, Linux x64, and macOS ARM64
16
17
@@ -47,6 +48,7 @@ The config file is a simple JSON file placed next to the executable. The filenam
47
48
|`prefer_dark_mode`| No |`"default"`| Color scheme preference: `"default"` (let OS decide), `"dark"` (request dark theme), `"light"` (request light theme). Only affects sites that support `prefers-color-scheme` CSS. Windows only |
48
49
|`force_dark_mode`| No |`"off"`| Force-dark rendering: `"on"` or `"off"`. When `"on"`, forces all sites into dark mode even if they don't natively support it — same as Chrome's force-dark flag. Windows only |
49
50
|`start_minimized`| No |`"off"`| Start minimized to taskbar: `"on"` or `"off"`|
51
+
|`allow_only_one_instance`| No |`"off"`| Single-instance mode: `"off"` (allow multiple), `"on"` or `"first"` (exit if already running), `"last"` (kill existing and take over). Windows only |
50
52
51
53
### Example — minimal
52
54
@@ -65,7 +67,8 @@ The config file is a simple JSON file placed next to the executable. The filenam
65
67
"icon": "music.png",
66
68
"prefer_dark_mode": "dark",
67
69
"force_dark_mode": "off",
68
-
"start_minimized": "off"
70
+
"start_minimized": "off",
71
+
"allow_only_one_instance": "off"
69
72
}
70
73
```
71
74
@@ -85,6 +88,19 @@ The app automatically remembers your window position, size, and maximized state
85
88
- Updated every time you move, resize, or maximize/restore the window
86
89
- On next launch, the window opens exactly where you left it
87
90
- To reset to defaults, simply delete the `.window.json` file
91
+
- When multiple instances are allowed, each new instance opens with a +32px offset so windows don't stack exactly on top of each other
92
+
93
+
### Single-instance mode
94
+
95
+
**`allow_only_one_instance`** controls how the app handles multiple instances:
96
+
97
+
| Value | Behavior |
98
+
|-------|----------|
99
+
|`"off"` (default) | Multiple instances allowed. New windows cascade with a +32px offset |
100
+
|`"on"` or `"first"`| If an instance is already running, it is brought to the foreground (restored from minimized if needed) and the new one exits |
101
+
|`"last"`| If an instance is already running, it is terminated and the new one takes over |
102
+
103
+
This is useful for apps where only one window should exist at a time, like a dedicated music player or chat client.
88
104
89
105
## Platform Notes
90
106
@@ -94,7 +110,7 @@ The app automatically remembers your window position, size, and maximized state
-**Dynamic title sync**, **prefer_dark_mode**, and **force_dark_mode** use the WebView2 API and are only available on Windows. On macOS and Linux, the window title stays at the default unless a static `title` is set in the config.
113
+
-**Dynamic title sync**, **prefer_dark_mode**, **force_dark_mode**, and **allow_only_one_instance** use Windows APIs and are only available on Windows. On macOS and Linux, the window title stays at the default unless a static `title` is set in the config.
98
114
99
115
## Building from Source
100
116
@@ -128,7 +144,7 @@ The binary will be at `src-tauri/target/release/app` (or `app.exe` on Windows).
128
144
├── tauri.conf.json # Tauri build config
129
145
└── src/
130
146
├── main.rs # Entry point
131
-
├── lib.rs # App setup, navigation, title sync, dark mode, window state
147
+
├── lib.rs # App setup, navigation, title sync, dark mode, window state, single-instance
Copy file name to clipboardExpand all lines: app.json
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -15,5 +15,8 @@
15
15
"force_dark_mode": "off",
16
16
17
17
"_comment_start_minimized": "Optional. Values: 'on' or 'off'. When 'on', the app starts minimized to the taskbar.",
18
-
"start_minimized": "off"
18
+
"start_minimized": "off",
19
+
20
+
"_comment_allow_only_one_instance": "Optional. Values: 'off' (allow multiple instances), 'on' or 'first' (exit if already running), 'last' (kill existing instance and take over). Windows only.",
0 commit comments