stoat-for-desktop/src/native/autoLaunch.ts

20 lines
421 B
TypeScript

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