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:
2026-03-19 21:56:35 +10:00
co-authored by Claude Sonnet 4.6
parent 3cba8552cf
commit 7e18aa9b4f
7 changed files with 27 additions and 6 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 B

+24 -3
View File
@@ -108,9 +108,15 @@ function createWindow() {
mainWindow.show(); mainWindow.show();
}); });
// Close → quit app (no tray) // Close → minimize to tray (hide window, keep server running)
mainWindow.on('close', () => { mainWindow.on('close', (event) => {
isQuitting = true; if (!isQuitting) {
event.preventDefault();
mainWindow.hide();
if (process.platform === 'darwin' && app.dock) {
app.dock.hide();
}
}
}); });
mainWindow.on('closed', () => { mainWindow.on('closed', () => {
@@ -148,6 +154,7 @@ function createTray() {
if (mainWindow) { if (mainWindow) {
mainWindow.show(); mainWindow.show();
mainWindow.focus(); mainWindow.focus();
if (process.platform === 'darwin' && app.dock) app.dock.show();
} else { } else {
createWindow(); createWindow();
} }
@@ -174,11 +181,23 @@ function createTray() {
tray.setContextMenu(contextMenu); 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) // Double-click tray → show window (Windows/Linux)
tray.on('double-click', () => { tray.on('double-click', () => {
if (mainWindow) { if (mainWindow) {
mainWindow.show(); mainWindow.show();
mainWindow.focus(); mainWindow.focus();
if (process.platform === 'darwin' && app.dock) app.dock.show();
} }
}); });
} }
@@ -215,6 +234,8 @@ app.on('activate', () => {
// macOS dock click → show window // macOS dock click → show window
if (mainWindow) { if (mainWindow) {
mainWindow.show(); mainWindow.show();
mainWindow.focus();
if (process.platform === 'darwin' && app.dock) app.dock.show();
} else { } else {
createWindow(); createWindow();
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "odo", "name": "odo",
"version": "0.9.5", "version": "0.9.6",
"description": "ODO — OpenClaw Dashboard Orchestrator", "description": "ODO — OpenClaw Dashboard Orchestrator",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
+1 -1
View File
@@ -7,6 +7,6 @@ const { contextBridge } = require('electron');
contextBridge.exposeInMainWorld('odo', { contextBridge.exposeInMainWorld('odo', {
platform: process.platform, platform: process.platform,
version: '0.9.4', version: '0.9.6',
isElectron: true isElectron: true
}); });
+1 -1
View File
@@ -24,7 +24,7 @@ const SCRIPT_DIR = __dirname;
const MANAGER_CONFIG = path.join(SCRIPT_DIR, 'manager-config.json'); const MANAGER_CONFIG = path.join(SCRIPT_DIR, 'manager-config.json');
let PORT = 3333; let PORT = 3333;
let HOST = '0.0.0.0'; let HOST = '0.0.0.0';
const APP_VERSION = '0.9.4'; const APP_VERSION = '0.9.6';
// --port 参数 // --port 参数
const portIdx = process.argv.indexOf('--port'); const portIdx = process.argv.indexOf('--port');
if (portIdx !== -1 && process.argv[portIdx + 1]) PORT = parseInt(process.argv[portIdx + 1]) || 3333; if (portIdx !== -1 && process.argv[portIdx + 1]) PORT = parseInt(process.argv[portIdx + 1]) || 3333;