Add start minimized option

This commit is contained in:
smartfridge 2022-12-13 13:13:25 +01:00
parent a01b9f3f8a
commit f8c785e9b3
5 changed files with 31 additions and 2 deletions

View file

@ -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-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": "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-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": "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-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", "settings-mobileMode": "Mobile mode",

View file

@ -124,6 +124,7 @@
inviteWebsocket: true, inviteWebsocket: true,
mobileMode: false, mobileMode: false,
trayIcon: "default", trayIcon: "default",
startMinimized: false,
performanceMode: "none" performanceMode: "none"
}); });
setTimeout(() => window.armcordinternal.restart(), 5000); setTimeout(() => window.armcordinternal.restart(), 5000);
@ -155,6 +156,7 @@
automaticPatches: false, automaticPatches: false,
performanceMode: "none", performanceMode: "none",
alternativePaste: false, alternativePaste: false,
startMinimized: false,
trayIcon: "default", trayIcon: "default",
mods: options.mod, mods: options.mod,
inviteWebsocket: true inviteWebsocket: true
@ -170,6 +172,7 @@
automaticPatches: false, automaticPatches: false,
mobileMode: false, mobileMode: false,
mods: "none", mods: "none",
startMinimized: false,
alternativePaste: false, alternativePaste: false,
performanceMode: "none", performanceMode: "none",
trayIcon: "default", trayIcon: "default",

View file

@ -52,6 +52,14 @@
</div> </div>
<br /> <br />
<div class="switch acMinimized">
<label class="header" data-string="settings-startMinimized"></label>
<input id="startMinimized" class="tgl tgl-light left" data-setting="startMinimized" type="checkbox" />
<label class="tgl-btn left" for="startMinimized"></label>
<p class="description" data-string="settings-startMinimized-desc"></p>
</div>
<br />
<div class="switch acPatches"> <div class="switch acPatches">
<label class="header" data-string="settings-patches"></label> <label class="header" data-string="settings-patches"></label>
<input id="patches" class="tgl tgl-light left" data-setting="automaticPatches" type="checkbox" /> <input id="patches" class="tgl tgl-light left" data-setting="automaticPatches" type="checkbox" />

View file

@ -49,6 +49,7 @@ export function setup() {
performanceMode: "none", performanceMode: "none",
skipSplash: false, skipSplash: false,
inviteWebsocket: true, inviteWebsocket: true,
startMinimized: false,
mobileMode: false, mobileMode: false,
trayIcon: "default", trayIcon: "default",
doneSetup: false doneSetup: false
@ -244,6 +245,7 @@ export interface Settings {
mobileMode: boolean; mobileMode: boolean;
skipSplash: boolean; skipSplash: boolean;
performanceMode: string; performanceMode: string;
startMinimized: boolean;
inviteWebsocket: boolean; inviteWebsocket: boolean;
trayIcon: string; trayIcon: string;
doneSetup: boolean; doneSetup: boolean;

View file

@ -51,11 +51,18 @@ contextMenu({
] ]
}); });
async function doAfterDefiningTheWindow() { async function doAfterDefiningTheWindow() {
if (await getConfig("startMinimized")) {
mainWindow.hide();
} else {
mainWindow.show();
}
if (transparency && process.platform === "win32") { if (transparency && process.platform === "win32") {
import("@pyke/vibe").then((vibe) => { import("@pyke/vibe").then(async (vibe) => {
vibe.applyEffect(mainWindow, "acrylic"); vibe.applyEffect(mainWindow, "acrylic");
vibe.forceTheme(mainWindow, "dark"); vibe.forceTheme(mainWindow, "dark");
mainWindow.show(); if ((await getConfig("startMinimized")) == false) {
mainWindow.show();
}
}); });
} }
var ignoreProtocolWarning = await getConfig("ignoreProtocolWarning"); var ignoreProtocolWarning = await getConfig("ignoreProtocolWarning");
@ -251,12 +258,18 @@ async function doAfterDefiningTheWindow() {
} else { } else {
await mainWindow.loadFile(path.join(__dirname, "/content/splash.html")); await mainWindow.loadFile(path.join(__dirname, "/content/splash.html"));
} }
if (await getConfig("startMinimized")) {
mainWindow.hide();
} else {
mainWindow.show();
}
} }
export function createCustomWindow() { export function createCustomWindow() {
mainWindow = new BrowserWindow({ mainWindow = new BrowserWindow({
width: 300, width: 300,
height: 350, height: 350,
title: "ArmCord", title: "ArmCord",
show: false,
darkTheme: true, darkTheme: true,
icon: iconPath, icon: iconPath,
frame: false, frame: false,
@ -276,6 +289,7 @@ export function createNativeWindow() {
title: "ArmCord", title: "ArmCord",
darkTheme: true, darkTheme: true,
icon: iconPath, icon: iconPath,
show: false,
frame: true, frame: true,
autoHideMenuBar: true, autoHideMenuBar: true,
webPreferences: { webPreferences: {