mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
added option to start hydra on system startup
This commit is contained in:
parent
5b9af9e0ea
commit
970a3be280
9 changed files with 34 additions and 27 deletions
|
|
@ -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());
|
||||
|
|
|
|||
24
src/main/events/user-preferences/auto-launch.ts
Normal file
24
src/main/events/user-preferences/auto-launch.ts
Normal 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",
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue