Files
stoat-desktop/src/native/autoLaunch.ts
T
2025-12-29 17:55:55 +00:00

24 lines
467 B
TypeScript

import AutoLaunch from "auto-launch";
import { ipcMain } from "electron";
import { mainWindow } from "./window";
export const autoLaunch = new AutoLaunch({
name: "Stoat",
});
ipcMain.on("isAutostart?", () =>
autoLaunch
.isEnabled()
.then((enabled) => mainWindow.webContents.send("isAutostart", enabled)),
);
ipcMain.on("setAutostart", (_event, state: boolean) => {
if (state) {
autoLaunch.enable();
} else {
autoLaunch.disable();
}
});