Add launch on startup.
This commit is contained in:
@@ -116,6 +116,25 @@ function createWindow(): void {
|
|||||||
{ role: "togglefullscreen" },
|
{ 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' }
|
// { role: 'windowMenu' }
|
||||||
{
|
{
|
||||||
label: "Window",
|
label: "Window",
|
||||||
@@ -132,17 +151,6 @@ function createWindow(): void {
|
|||||||
: [{ role: "close" }]),
|
: [{ role: "close" }]),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
role: "help",
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: "Learn More",
|
|
||||||
click: async (): Promise<void> => {
|
|
||||||
await shell.openExternal("https://electronjs.org");
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
label: "Development",
|
label: "Development",
|
||||||
@@ -219,6 +227,13 @@ function createWindow(): void {
|
|||||||
|
|
||||||
mainWindow.on("ready-to-show", () => {
|
mainWindow.on("ready-to-show", () => {
|
||||||
mainWindow.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) => {
|
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
|
//Create Tray
|
||||||
const trayicon = nativeImage.createFromPath(appIcon);
|
const trayicon = nativeImage.createFromPath(appIcon);
|
||||||
const tray = new Tray(trayicon.resize({ width: 16 }));
|
const tray = new Tray(trayicon.resize({ width: 16 }));
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import Store from "electron-store";
|
|||||||
const store = new Store({
|
const store = new Store({
|
||||||
defaults: {
|
defaults: {
|
||||||
settings: {
|
settings: {
|
||||||
|
runOnStartup: true,
|
||||||
filepaths: [],
|
filepaths: [],
|
||||||
qbFilePath: "",
|
qbFilePath: "",
|
||||||
runWatcherOnStartup: true,
|
runWatcherOnStartup: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user