mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-20 01:33:56 +00:00
20 lines
430 B
TypeScript
20 lines
430 B
TypeScript
import { registerEvent } from "../register-event";
|
|
import AutoLaunch from "auto-launch";
|
|
import { app } from "electron";
|
|
|
|
const autoLaunch = async (
|
|
_event: Electron.IpcMainInvokeEvent,
|
|
enabled: boolean
|
|
) => {
|
|
const appLauncher = new AutoLaunch({
|
|
name: app.getName(),
|
|
});
|
|
if (enabled) {
|
|
appLauncher.enable().catch();
|
|
} else {
|
|
appLauncher.disable().catch();
|
|
}
|
|
};
|
|
|
|
registerEvent("autoLaunch", autoLaunch);
|