added option to start hydra on system startup

This commit is contained in:
Hachi-R 2024-05-05 18:13:28 -03:00
parent 5b9af9e0ea
commit 970a3be280
9 changed files with 34 additions and 27 deletions

View file

@ -26,6 +26,7 @@ import "./torrenting/resume-game-download";
import "./torrenting/start-game-download";
import "./user-preferences/get-user-preferences";
import "./user-preferences/update-user-preferences";
import "./user-preferences/auto-launch";
ipcMain.handle("ping", () => "pong");
ipcMain.handle("getVersion", () => app.getVersion());

View file

@ -0,0 +1,24 @@
import { registerEvent } from "../register-event";
import AutoLaunch from "auto-launch";
const autoLaunch = async (
_event: Electron.IpcMainInvokeEvent,
enabled: boolean
) => {
const appLauncher = new AutoLaunch({
name: "Hydra",
});
if (enabled) {
appLauncher
.enable()
.catch((err) => console.error("Error enabling auto-launch:", err));
} else {
appLauncher
.disable()
.catch((err) => console.error("Error disabling auto-launch:", err));
}
};
registerEvent(autoLaunch, {
name: "autoLaunch",
});