fix: make minimize only run on autostart
This commit is contained in:
parent
40b952d8bf
commit
dd44602730
2 changed files with 9 additions and 5 deletions
|
@ -10,6 +10,7 @@ import { join } from "path";
|
||||||
|
|
||||||
interface AutoStart {
|
interface AutoStart {
|
||||||
isEnabled(): boolean;
|
isEnabled(): boolean;
|
||||||
|
wasAutoStarted(): boolean;
|
||||||
enable(): void;
|
enable(): void;
|
||||||
disable(): void;
|
disable(): void;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +22,7 @@ function makeAutoStartLinux(): AutoStart {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isEnabled: () => existsSync(file),
|
isEnabled: () => existsSync(file),
|
||||||
|
wasAutoStarted: () => process.argv.includes("--autostart"),
|
||||||
enable() {
|
enable() {
|
||||||
const desktopFile = `
|
const desktopFile = `
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
|
@ -28,7 +30,7 @@ Type=Application
|
||||||
Version=1.0
|
Version=1.0
|
||||||
Name=Vencord
|
Name=Vencord
|
||||||
Comment=Vencord autostart script
|
Comment=Vencord autostart script
|
||||||
Exec=${process.execPath}
|
Exec=${process.execPath} --autostart
|
||||||
Terminal=false
|
Terminal=false
|
||||||
StartupNotify=false
|
StartupNotify=false
|
||||||
`.trim();
|
`.trim();
|
||||||
|
@ -42,8 +44,9 @@ StartupNotify=false
|
||||||
|
|
||||||
const autoStartWindowsMac: AutoStart = {
|
const autoStartWindowsMac: AutoStart = {
|
||||||
isEnabled: () => app.getLoginItemSettings().openAtLogin,
|
isEnabled: () => app.getLoginItemSettings().openAtLogin,
|
||||||
|
wasAutoStarted: () => app.getLoginItemSettings().wasOpenedAtLogin,
|
||||||
enable: () => app.setLoginItemSettings({ openAtLogin: true }),
|
enable: () => app.setLoginItemSettings({ openAtLogin: true }),
|
||||||
disable: () => app.setLoginItemSettings({ openAtLogin: false })
|
disable: () => app.setLoginItemSettings({ openAtLogin: false }),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const autoStart = process.platform === "linux" ? makeAutoStartLinux() : autoStartWindowsMac;
|
export const autoStart = process.platform === "linux" ? makeAutoStartLinux() : autoStartWindowsMac;
|
||||||
|
|
|
@ -39,6 +39,7 @@ import { createSplashWindow } from "./splash";
|
||||||
import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally";
|
import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally";
|
||||||
import { applyDeckKeyboardFix, askToApplySteamLayout, isDeckGameMode } from "./utils/steamOS";
|
import { applyDeckKeyboardFix, askToApplySteamLayout, isDeckGameMode } from "./utils/steamOS";
|
||||||
import { downloadVencordFiles, ensureVencordFiles } from "./utils/vencordLoader";
|
import { downloadVencordFiles, ensureVencordFiles } from "./utils/vencordLoader";
|
||||||
|
import { autoStart } from "./autoStart";
|
||||||
|
|
||||||
let isQuitting = false;
|
let isQuitting = false;
|
||||||
let tray: Tray;
|
let tray: Tray;
|
||||||
|
@ -442,8 +443,8 @@ function createMainWindow() {
|
||||||
const runVencordMain = once(() => require(join(VENCORD_FILES_DIR, "vencordDesktopMain.js")));
|
const runVencordMain = once(() => require(join(VENCORD_FILES_DIR, "vencordDesktopMain.js")));
|
||||||
|
|
||||||
export async function createWindows() {
|
export async function createWindows() {
|
||||||
const { startMinimized } = Settings.store;
|
const shouldStartMinimized = Settings.store.startMinimized && autoStart.wasAutoStarted();
|
||||||
const splash = createSplashWindow(startMinimized);
|
const splash = createSplashWindow(shouldStartMinimized);
|
||||||
// SteamOS letterboxes and scales it terribly, so just full screen it
|
// SteamOS letterboxes and scales it terribly, so just full screen it
|
||||||
if (isDeckGameMode) splash.setFullScreen(true);
|
if (isDeckGameMode) splash.setFullScreen(true);
|
||||||
await ensureVencordFiles();
|
await ensureVencordFiles();
|
||||||
|
@ -454,7 +455,7 @@ export async function createWindows() {
|
||||||
mainWin.webContents.on("did-finish-load", () => {
|
mainWin.webContents.on("did-finish-load", () => {
|
||||||
splash.destroy();
|
splash.destroy();
|
||||||
|
|
||||||
if (!startMinimized || isDeckGameMode) mainWin!.show();
|
if (!shouldStartMinimized || isDeckGameMode) mainWin!.show();
|
||||||
|
|
||||||
if (isDeckGameMode) {
|
if (isDeckGameMode) {
|
||||||
// always use entire display
|
// always use entire display
|
||||||
|
|
Loading…
Reference in a new issue