mirror of
https://github.com/dtzp555-max/odo.git
synced 2026-07-19 09:44:37 +00:00
feat: add tray support and cross-platform packaging assets (v0.9.6)
- Generate placeholder icons: icon.png (512x512), tray-icon.png (16x16), icon.icns (macOS) - Fix window close behavior: hide to tray instead of quitting - Add tray left-click and double-click handlers to restore window - Add app.dock.hide/show on macOS for proper dock visibility - Bump version to 0.9.6 in package.json, preload.js, openclaw-manager.js Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -108,9 +108,15 @@ function createWindow() {
|
||||
mainWindow.show();
|
||||
});
|
||||
|
||||
// Close → quit app (no tray)
|
||||
mainWindow.on('close', () => {
|
||||
isQuitting = true;
|
||||
// Close → minimize to tray (hide window, keep server running)
|
||||
mainWindow.on('close', (event) => {
|
||||
if (!isQuitting) {
|
||||
event.preventDefault();
|
||||
mainWindow.hide();
|
||||
if (process.platform === 'darwin' && app.dock) {
|
||||
app.dock.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mainWindow.on('closed', () => {
|
||||
@@ -148,6 +154,7 @@ function createTray() {
|
||||
if (mainWindow) {
|
||||
mainWindow.show();
|
||||
mainWindow.focus();
|
||||
if (process.platform === 'darwin' && app.dock) app.dock.show();
|
||||
} else {
|
||||
createWindow();
|
||||
}
|
||||
@@ -174,11 +181,23 @@ function createTray() {
|
||||
|
||||
tray.setContextMenu(contextMenu);
|
||||
|
||||
// Left-click tray → show window (Windows/Linux; macOS shows context menu by default)
|
||||
tray.on('click', () => {
|
||||
if (mainWindow) {
|
||||
mainWindow.show();
|
||||
mainWindow.focus();
|
||||
if (process.platform === 'darwin' && app.dock) app.dock.show();
|
||||
} else {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
|
||||
// Double-click tray → show window (Windows/Linux)
|
||||
tray.on('double-click', () => {
|
||||
if (mainWindow) {
|
||||
mainWindow.show();
|
||||
mainWindow.focus();
|
||||
if (process.platform === 'darwin' && app.dock) app.dock.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -215,6 +234,8 @@ app.on('activate', () => {
|
||||
// macOS dock click → show window
|
||||
if (mainWindow) {
|
||||
mainWindow.show();
|
||||
mainWindow.focus();
|
||||
if (process.platform === 'darwin' && app.dock) app.dock.show();
|
||||
} else {
|
||||
createWindow();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user