127d1430a9
Signed-off-by: Mihai <cristian@mihaimuresan.com> Co-authored-by: Mihai <cristian@mihaimuresan.com>
28 lines
655 B
TypeScript
28 lines
655 B
TypeScript
import AutoLaunch from "auto-launch";
|
|
|
|
import { ipcMain } from "electron";
|
|
|
|
import { mainWindow } from "./window";
|
|
|
|
export const autoLaunch = new AutoLaunch({
|
|
name: "Stoat",
|
|
});
|
|
|
|
ipcMain.handle("getAutostart", async () => {
|
|
const enabled = await autoLaunch.isEnabled();
|
|
return enabled;
|
|
});
|
|
|
|
ipcMain.handle("setAutostart", async (_event, state: boolean) => {
|
|
if (state) {
|
|
await autoLaunch.enable();
|
|
console.log("Received new configuration autoStart: true");
|
|
} else {
|
|
await autoLaunch.disable();
|
|
console.log("Received new configuration autoStart: false");
|
|
}
|
|
|
|
const enabled = await autoLaunch.isEnabled();
|
|
return enabled;
|
|
});
|