autostart: improve typing
This commit is contained in:
parent
f232defd1c
commit
a993d34c9d
1 changed files with 8 additions and 2 deletions
|
@ -8,7 +8,13 @@ import { app } from "electron";
|
||||||
import { existsSync, mkdirSync, rmSync, writeFileSync } from "fs";
|
import { existsSync, mkdirSync, rmSync, writeFileSync } from "fs";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
|
|
||||||
function makeAutoStartLinux() {
|
interface AutoStart {
|
||||||
|
isEnabled(): boolean;
|
||||||
|
enable(): void;
|
||||||
|
disable(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeAutoStartLinux(): AutoStart {
|
||||||
const dir = join(process.env.HOME!, ".config", "autostart");
|
const dir = join(process.env.HOME!, ".config", "autostart");
|
||||||
const file = join(dir, "vencord.desktop");
|
const file = join(dir, "vencord.desktop");
|
||||||
|
|
||||||
|
@ -33,7 +39,7 @@ StartupNotify=false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const autoStartWindowsMac = {
|
const autoStartWindowsMac: AutoStart = {
|
||||||
isEnabled: () => app.getLoginItemSettings().openAtLogin,
|
isEnabled: () => app.getLoginItemSettings().openAtLogin,
|
||||||
enable: () => app.setLoginItemSettings({ openAtLogin: true }),
|
enable: () => app.setLoginItemSettings({ openAtLogin: true }),
|
||||||
disable: () => app.setLoginItemSettings({ openAtLogin: false })
|
disable: () => app.setLoginItemSettings({ openAtLogin: false })
|
||||||
|
|
Loading…
Reference in a new issue