From f8c785e9b313b863e29fb4b7a4e4ea159d884eee Mon Sep 17 00:00:00 2001 From: smartfridge <37928912+smartfrigde@users.noreply.github.com> Date: Tue, 13 Dec 2022 13:13:25 +0100 Subject: [PATCH] Add start minimized option --- assets/lang/en-US.json | 2 ++ src/content/setup.html | 3 +++ src/settings/settings.html | 8 ++++++++ src/utils.ts | 2 ++ src/window.ts | 18 ++++++++++++++++-- 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/assets/lang/en-US.json b/assets/lang/en-US.json index fcfc7d1..5666b43 100644 --- a/assets/lang/en-US.json +++ b/assets/lang/en-US.json @@ -22,6 +22,8 @@ "settings-csp-desc": "ArmCord CSP is our system that manages loading custom content loading into the Discord app. Stuff like\n client mods and themes depend on it. Disable if you want to get rid of mods and custom styles.", "settings-tray": "Minimize to tray", "settings-tray-desc": "When disabled, ArmCord will close like any other window when closed, otherwise it'll sit back and relax\n in your system tray for later.", + "settings-startMinimized": "Start minimized", + "settings-startMinimized-desc": "ArmCord starts in background and remains out of your way.", "settings-patches": "Automatic Patches", "settings-patches-desk": "Fetches automatic patches that are distributed if release turns out to have bugs after release. Usually\n you don't have to keep this enabled, unless notified in support Discord.", "settings-mobileMode": "Mobile mode", diff --git a/src/content/setup.html b/src/content/setup.html index 75048c5..bc945f3 100644 --- a/src/content/setup.html +++ b/src/content/setup.html @@ -124,6 +124,7 @@ inviteWebsocket: true, mobileMode: false, trayIcon: "default", + startMinimized: false, performanceMode: "none" }); setTimeout(() => window.armcordinternal.restart(), 5000); @@ -155,6 +156,7 @@ automaticPatches: false, performanceMode: "none", alternativePaste: false, + startMinimized: false, trayIcon: "default", mods: options.mod, inviteWebsocket: true @@ -170,6 +172,7 @@ automaticPatches: false, mobileMode: false, mods: "none", + startMinimized: false, alternativePaste: false, performanceMode: "none", trayIcon: "default", diff --git a/src/settings/settings.html b/src/settings/settings.html index fcb5755..c55d99f 100644 --- a/src/settings/settings.html +++ b/src/settings/settings.html @@ -52,6 +52,14 @@
+
+ + + +

+
+
+
diff --git a/src/utils.ts b/src/utils.ts index 36e5867..8694d16 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -49,6 +49,7 @@ export function setup() { performanceMode: "none", skipSplash: false, inviteWebsocket: true, + startMinimized: false, mobileMode: false, trayIcon: "default", doneSetup: false @@ -244,6 +245,7 @@ export interface Settings { mobileMode: boolean; skipSplash: boolean; performanceMode: string; + startMinimized: boolean; inviteWebsocket: boolean; trayIcon: string; doneSetup: boolean; diff --git a/src/window.ts b/src/window.ts index a217a93..0f8962a 100644 --- a/src/window.ts +++ b/src/window.ts @@ -51,11 +51,18 @@ contextMenu({ ] }); async function doAfterDefiningTheWindow() { + if (await getConfig("startMinimized")) { + mainWindow.hide(); + } else { + mainWindow.show(); + } if (transparency && process.platform === "win32") { - import("@pyke/vibe").then((vibe) => { + import("@pyke/vibe").then(async (vibe) => { vibe.applyEffect(mainWindow, "acrylic"); vibe.forceTheme(mainWindow, "dark"); - mainWindow.show(); + if ((await getConfig("startMinimized")) == false) { + mainWindow.show(); + } }); } var ignoreProtocolWarning = await getConfig("ignoreProtocolWarning"); @@ -251,12 +258,18 @@ async function doAfterDefiningTheWindow() { } else { await mainWindow.loadFile(path.join(__dirname, "/content/splash.html")); } + if (await getConfig("startMinimized")) { + mainWindow.hide(); + } else { + mainWindow.show(); + } } export function createCustomWindow() { mainWindow = new BrowserWindow({ width: 300, height: 350, title: "ArmCord", + show: false, darkTheme: true, icon: iconPath, frame: false, @@ -276,6 +289,7 @@ export function createNativeWindow() { title: "ArmCord", darkTheme: true, icon: iconPath, + show: false, frame: true, autoHideMenuBar: true, webPreferences: {