Skip to content

Commit 1b4a7d7

Browse files
committed
docs(system-tray): remove SingleInstanceManager (pending deprecation)
1 parent 6010e6b commit 1b4a7d7

2 files changed

Lines changed: 1 addition & 53 deletions

File tree

docs/runtime/system-tray/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Where the standard Java `SystemTray` gives you a pixelated icon and a crude AWT
2020
| Checkable items | Not available | Native checkable items |
2121
| Primary action (left-click) | Not available | Per-platform behavior |
2222
| Tray position detection | Not available | Built-in, for window positioning |
23-
| Single instance | Not available | Built-in with restore callback |
2423
| Popup window | Not available | `TrayApp` — Compose window anchored to tray |
2524

2625
## Quick example
@@ -62,4 +61,4 @@ dependencies {
6261
- [Tray API](tray-api.md)`Tray()` composable, icon types, primary actions, platform-specific icons
6362
- [Menu DSL](menu-dsl.md) — Items, checkable items, submenus, dividers, icons in menus
6463
- [TrayApp](tray-app.md) — Popup window anchored to the tray icon
65-
- [Utilities](utilities.md)Single instance management, tray position detection, dark mode detection
64+
- [Utilities](utilities.md)Tray position detection, dark mode detection

docs/runtime/system-tray/utilities.md

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,6 @@
22

33
ComposeNativeTray includes several utilities that are essential for tray-based applications.
44

5-
## Single Instance Manager
6-
7-
Most tray apps should only run one instance. `SingleInstanceManager` enforces this and lets the second launch restore the existing window:
8-
9-
```kotlin
10-
fun main() {
11-
val isSingleInstance = SingleInstanceManager.isSingleInstance(
12-
onRestoreRequest = {
13-
// Called when another instance tries to start
14-
isWindowVisible = true
15-
}
16-
)
17-
18-
if (!isSingleInstance) {
19-
// Another instance is already running — it received the restore request
20-
return
21-
}
22-
23-
application {
24-
// Your app...
25-
}
26-
}
27-
```
28-
29-
### Custom configuration
30-
31-
```kotlin
32-
SingleInstanceManager.configuration = SingleInstanceManager.Configuration(
33-
lockDirectory = Path("/custom/lock/dir"),
34-
appIdentifier = "com.example.myapp",
35-
)
36-
```
37-
38-
### Data passing between instances
39-
40-
The new instance can write data to a temporary file that the existing instance reads:
41-
42-
```kotlin
43-
val isSingleInstance = SingleInstanceManager.isSingleInstance(
44-
onRestoreFileCreated = { path ->
45-
// New instance writes data here
46-
path.writeText("open-file:/path/to/file.txt")
47-
},
48-
onRestoreRequest = { path ->
49-
// Existing instance reads it
50-
val data = path.readText()
51-
handleDeepLink(data)
52-
}
53-
)
54-
```
55-
565
## Tray Position Detection
576

587
Position a window next to the tray icon — essential for `TrayApp`-style popup windows:

0 commit comments

Comments
 (0)