feat: add auto-launch functionality for desktop app

- Implemented IPC channels for managing auto-launch settings.
- Enhanced main process to handle auto-launch behavior on startup.
- Updated UI components to allow users to configure launch options.
- Integrated analytics tracking for auto-launch events.

This commit introduces the ability for users to enable or disable the application launching at system startup, along with options for starting minimized to the tray.
This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-04-20 12:42:06 -07:00
parent 7a389e7a25
commit 24383a3741
9 changed files with 493 additions and 17 deletions

View file

@ -8,11 +8,18 @@ const isDev = !app.isPackaged;
const HOSTED_FRONTEND_URL = process.env.HOSTED_FRONTEND_URL as string;
let mainWindow: BrowserWindow | null = null;
let isQuitting = false;
export function getMainWindow(): BrowserWindow | null {
return mainWindow;
}
// Called from main.ts on `before-quit` so the close-to-tray handler knows
// to actually let the window die instead of hiding it.
export function markQuitting(): void {
isQuitting = true;
}
export function createMainWindow(initialPath = '/dashboard'): BrowserWindow {
mainWindow = new BrowserWindow({
width: 1280,
@ -70,6 +77,16 @@ export function createMainWindow(initialPath = '/dashboard'): BrowserWindow {
mainWindow.webContents.openDevTools();
}
// Hide-to-tray on close (don't actually destroy the window unless the
// user really is quitting). Applies to every instance — including the one
// created lazily after a launch-at-login boot.
mainWindow.on('close', (e) => {
if (!isQuitting && mainWindow) {
e.preventDefault();
mainWindow.hide();
}
});
mainWindow.on('closed', () => {
mainWindow = null;
});