Tons of Stuff
Some checks failed
Deploy Backend to Docker / deploy (push) Failing after 6m13s
Deploy Backend to Docker / deploy-portainer (push) Has been skipped

This commit is contained in:
2025-12-03 20:19:40 -05:00
parent 0b86c88eb4
commit b7c2e0fc24
19 changed files with 1783 additions and 134 deletions

View File

@@ -1,13 +1,19 @@
import { app, BrowserWindow } from 'electron';
import { app, BrowserWindow, Tray, Menu, nativeImage } from 'electron';
import * as path from 'path';
import { setupIpcHandlers, cleanupIpcHandlers } from './ipc-handlers';
import { initDatabase, closeDatabase } from './database';
let mainWindow: BrowserWindow | null = null;
let tray: Tray | null = null;
function createWindow(): void {
mainWindow = new BrowserWindow({
width: 1400,
height: 900,
minWidth: 1000,
minHeight: 700,
frame: false,
backgroundColor: '#0a0e27',
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
nodeIntegration: false,
@@ -34,12 +40,53 @@ function createWindow(): void {
});
}
app.whenReady().then(createWindow);
function createTray(): void {
// Create a simple icon for the tray (16x16 cyan square)
const icon = nativeImage.createFromDataURL(
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAdgAAAHYBTnsmCAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABNSURBVDiNY/z//z8DJYCJgUIwasCoAaMGjBowaMIAhv///zNQCpiYKASjBowaMGrAqAGDJgxGDRg1YNSAUQNGDRg0YTBqwKgBowYMmjAAALmyAwVYbMsAAAAASUVORK5CYII='
);
tray = new Tray(icon);
const contextMenu = Menu.buildFromTemplate([
{
label: 'Show rmtPocketWatcher',
click: () => {
if (mainWindow) {
mainWindow.show();
mainWindow.focus();
}
}
},
{
label: 'Quit',
click: () => {
app.quit();
}
}
]);
tray.setToolTip('rmtPocketWatcher');
tray.setContextMenu(contextMenu);
// Double-click to show window
tray.on('double-click', () => {
if (mainWindow) {
mainWindow.show();
mainWindow.focus();
}
});
}
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
app.whenReady().then(() => {
initDatabase();
createTray();
createWindow();
});
app.on('window-all-closed', (e: Event) => {
// Prevent app from quitting when window is closed (allow tray to keep it running)
e.preventDefault();
});
app.on('activate', () => {
@@ -50,4 +97,5 @@ app.on('activate', () => {
app.on('before-quit', () => {
cleanupIpcHandlers();
closeDatabase();
});