Add launch on startup.

This commit is contained in:
Patrick FIc
2025-04-01 16:39:37 -07:00
parent db81297c49
commit e4f204bf38
2 changed files with 27 additions and 20 deletions

View File

@@ -116,6 +116,25 @@ function createWindow(): void {
{ role: "togglefullscreen" },
],
},
{
label: "Application",
submenu: [
{
label: "Open on Startup",
checked: store.get("app.openOnStartup") as boolean,
type: "checkbox",
click: (): void => {
const currentSetting = store.get("app.openOnStartup") as boolean;
store.set("app.openOnStartup", !currentSetting);
log.info("Open on startup set to", !currentSetting);
app.setLoginItemSettings({
enabled: true, //This is a windows only command. Updates the task manager and registry.
openAtLogin: !currentSetting,
});
},
},
],
},
// { role: 'windowMenu' }
{
label: "Window",
@@ -132,17 +151,6 @@ function createWindow(): void {
: [{ role: "close" }]),
],
},
{
role: "help",
submenu: [
{
label: "Learn More",
click: async (): Promise<void> => {
await shell.openExternal("https://electronjs.org");
},
},
],
},
{
label: "Development",
@@ -219,6 +227,13 @@ function createWindow(): void {
mainWindow.on("ready-to-show", () => {
mainWindow.show();
//Start the HTTP server.
// Start the local HTTP server
try {
localServer.start();
} catch (error) {
log.error("Failed to start HTTP server:", errorTypeCheck(error));
}
});
mainWindow.on("close", (event: Electron.Event) => {
@@ -274,15 +289,6 @@ app.whenReady().then(async () => {
});
}
//Start the HTTP server.
// Start the local HTTP server
try {
localServer.start();
log.info("HTTP server initialized on port 1337");
} catch (error) {
log.error("Failed to start HTTP server:", errorTypeCheck(error));
}
//Create Tray
const trayicon = nativeImage.createFromPath(appIcon);
const tray = new Tray(trayicon.resize({ width: 16 }));

View File

@@ -3,6 +3,7 @@ import Store from "electron-store";
const store = new Store({
defaults: {
settings: {
runOnStartup: true,
filepaths: [],
qbFilePath: "",
runWatcherOnStartup: true,