Skip to content
ReviewOS
Features
Review
Durable review threads
Comments that follow the line through a rebase instead of vanishing.
Stacked pull requests
Dependent changes that merge in order and retarget themselves.
Agentic review
Coding agents as first-class authors and reviewers, with the audit trail to match.
Diffs that stay fast
Rendered on the server, against the merge base, readable at a hundred files.
Merge strategies and rules
Merge, squash, or rebase, gated by approvals, threads, and checks.
Repositories
Plain git hosting
Ordinary bare repositories on your disk, driven by the git binary.
Issues that link up
One number sequence, closing keywords, and references that resolve.
Search that reads like a query
Qualifiers, quoting, and negation, parsed properly rather than by regex.
Automation
Checks from your own CI
A status API your existing pipeline reports into, enforced at merge.
Webhooks you can trust
Signed, retried with backoff, and blocked from reaching your own network.
Notifications worth reading
Every message says why it reached you, and a burst arrives as one.
Operations
Self-hosting without a cluster
One database and one process. Scale the parts that need it, later.
Pages for every repository
A docs folder is a documentation site. Push, and the site is the branch.
Every feature, in one place.
All features
Repositories
Activity
Docs
Sign in
Sign up
Reload
also looking at this
stacks
/
vite-plugin-tauri
feat: call custom window on tray icon event
#13
Open
iamzjohn wants to merge
feat/custom_window
into
main
43 files
+5245
-1
Conversation
Commits
Checks
Files changed
Review screen
File 37 of 43
previous
next
all files
examples/tray-with-custom-tray-menu-window/src/tray.js
added
+110
-0
Changes to examples/tray-with-custom-tray-menu-window/src/tray.js
@@ -0,0 +1,110 @@
1
+
import
{
window
}
from
'@tauri-apps/api'
2
+
import
{
defaultWindowIcon
}
from
'@tauri-apps/api/app'
3
+
import
{
invoke
}
from
'@tauri-apps/api/core'
4
+
import
{
TrayIcon
}
from
'@tauri-apps/api/tray'
5
+
import
{
Webview
}
from
'@tauri-apps/api/webview'
6
+
import
{
Window
}
from
'@tauri-apps/api/window'
7
+
import
{
handleIconState
}
from
'@tauri-apps/plugin-positioner'
8
+
9
+
/**
10
+
* Initialize the system tray icon and custom window
11
+
*/
12
+
export
async
function
initTray
(
)
{
13
+
try
{
14
+
// eslint-disable-next-line no-console
15
+
console
.
log
(
'Initializing system tray...'
)
16
+
const
appWindow
=
window
.
getCurrentWindow
(
)
17
+
const
trayWindow
=
await
createTrayCustomWindow
(
)
18
+
19
+
const
action
=
async
(
event
)
=>
{
20
+
await
handleIconState
(
event
)
21
+
22
+
if
(
event
.
type
===
'Click'
)
{
23
+
if
(
await
trayWindow
.
isVisible
(
)
)
{
24
+
// If the tray window is visible, hide it
25
+
await
trayWindow
.
hide
(
)
26
+
}
27
+
else
{
28
+
await
trayWindow
.
show
(
)
29
+
await
invoke
(
'move_window'
,
{
windowLabel
:
'tray-window'
}
)
30
+
}
31
+
}
32
+
}
33
+
34
+
// Create the tray icon with minimal options
35
+
const
trayIcon
=
await
TrayIcon
.
new
(
{
36
+
id
:
'main-tray'
,
37
+
icon
:
await
defaultWindowIcon
(
)
,
38
+
tooltip
:
'Tauri Example App'
,
39
+
iconAsTemplate
:
true
,
40
+
action
,
41
+
}
)
42
+
43
+
// eslint-disable-next-line no-console
44
+
console
.
log
(
'System tray initialized with ID:'
,
trayIcon
.
id
)
45
+
46
+
// Setup window close handler to minimize to tray instead of quitting
47
+
appWindow
.
onCloseRequested
(
async
(
event
)
=>
{
48
+
// eslint-disable-next-line no-console
49
+
console
.
log
(
'Window close requested, minimizing to tray instead'
)
50
+
event
.
preventDefault
(
)
51
+
await
appWindow
.
hide
(
)
52
+
}
)
53
+
54
+
return
trayIcon
55
+
}
56
+
catch
(
error
)
{
57
+
console
.
error
(
'Failed to initialize system tray:'
,
error
)
58
+
throw
error
59
+
}
60
+
}
61
+
62
+
async
function
createTrayCustomWindow
(
url
=
'../index.html'
)
{
63
+
const
trayKey
=
'tray-window'
64
+
65
+
const
trayWindow
=
await
Window
.
getByLabel
(
trayKey
)
66
+
67
+
const
customTrayWindow
=
trayWindow
||
new
Window
(
trayKey
,
{
68
+
focus
:
true
,
69
+
decorations
:
false
,
70
+
resizable
:
false
,
71
+
height
:
300
,
72
+
width
:
400
,
73
+
skipTaskbar
:
true
,
74
+
visible
:
false
,
75
+
}
)
76
+
77
+
customTrayWindow
.
once
(
'tauri://created'
,
(
)
=>
{
78
+
// The window was created successfully
79
+
// eslint-disable-next-line no-console
80
+
console
.
log
(
'Custom tray window created successfully'
)
81
+
82
+
const
webview
=
new
Webview
(
customTrayWindow
,
trayKey
,
{
83
+
// url: 'https://github.com/tauri-apps/tauri',
84
+
url
,
85
+
height
:
300
,
86
+
width
:
400
,
87
+
x
:
0
,
88
+
y
:
0
,
89
+
}
)
90
+
91
+
webview
.
once
(
'tauri://created'
,
(
)
=>
{
92
+
// The webview was created successfully
93
+
// eslint-disable-next-line no-console
94
+
console
.
log
(
'Webview created successfully'
)
95
+
}
)
96
+
webview
.
once
(
'tauri://error'
,
(
e
)
=>
{
97
+
// The webview encountered an error
98
+
99
+
console
.
error
(
'Webview error:'
,
e
)
100
+
}
)
101
+
}
)
102
+
103
+
customTrayWindow
.
once
(
'tauri://error'
,
(
e
)
=>
{
104
+
// The window encountered an error
105
+
106
+
console
.
error
(
'Custom tray window error:'
,
e
)
107
+
}
)
108
+
109
+
return
customTrayWindow
110
+
}