Add dynamic icon option

This commit is contained in:
smartfridge 2022-12-27 11:34:26 +01:00
parent 7822317d3a
commit 7463856b63
5 changed files with 21 additions and 2 deletions

View file

@ -31,6 +31,8 @@
"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",
"settings-mobileMode-desc": "If you're on a device with touch-screen this feature is for you! It activates Discord's hidden mobile\n mode meant for phones and tablets. Only major feature missing is voice chat support. This is ideal for\n users on PinePhone and similar.", "settings-mobileMode-desc": "If you're on a device with touch-screen this feature is for you! It activates Discord's hidden mobile\n mode meant for phones and tablets. Only major feature missing is voice chat support. This is ideal for\n users on PinePhone and similar.",
"settings-dynamicIcon": "Dynamic icon",
"settings-dynamicIcon-desc": "Following Discord's behaviour on Windows, this shows unread messages/pings count on ArmCord's icon instead of it's tray.",
"settings-channel": "Discord channel", "settings-channel": "Discord channel",
"settings-channel-desc1": "You can use this setting to change current instance of Discord:", "settings-channel-desc1": "You can use this setting to change current instance of Discord:",
"settings-channel-desc2": "you're probably most familiar with this one. It's the one you see in default Discord\n client!", "settings-channel-desc2": "you're probably most familiar with this one. It's the one you see in default Discord\n client!",

View file

@ -123,6 +123,7 @@
useLegacyCapturer: false, useLegacyCapturer: false,
inviteWebsocket: true, inviteWebsocket: true,
mobileMode: false, mobileMode: false,
dynamicIcon: false,
trayIcon: "default", trayIcon: "default",
startMinimized: false, startMinimized: false,
performanceMode: "none" performanceMode: "none"
@ -157,6 +158,7 @@
performanceMode: "none", performanceMode: "none",
useLegacyCapturer: false, useLegacyCapturer: false,
alternativePaste: false, alternativePaste: false,
dynamicIcon: false,
disableAutogain: false, disableAutogain: false,
startMinimized: false, startMinimized: false,
trayIcon: "default", trayIcon: "default",
@ -175,6 +177,7 @@
mobileMode: false, mobileMode: false,
disableAutogain: false, disableAutogain: false,
mods: "none", mods: "none",
dynamicIcon: false,
useLegacyCapturer: false, useLegacyCapturer: false,
startMinimized: false, startMinimized: false,
alternativePaste: false, alternativePaste: false,

View file

@ -104,6 +104,14 @@
</div> </div>
<br /> <br />
<div class="switch acDynamicIcon">
<label class="header" data-string="settings-dynamicIcon"></label>
<input id="dynamicIcon" class="tgl tgl-light left" data-setting="dynamicIcon" type="checkbox" />
<label class="tgl-btn left" for="dynamicIcon"></label>
<p class="description" data-string="settings-dynamicIcon-desc"></p>
</div>
<br />
<div class="switch acChannel"> <div class="switch acChannel">
<select name="channel" data-setting="channel" class="left dropdown"> <select name="channel" data-setting="channel" class="left dropdown">
<option value="stable" selected>Stable</option> <option value="stable" selected>Stable</option>

View file

@ -50,6 +50,7 @@ export function setup() {
skipSplash: false, skipSplash: false,
inviteWebsocket: true, inviteWebsocket: true,
startMinimized: false, startMinimized: false,
dynamicIcon: false,
disableAutogain: false, disableAutogain: false,
useLegacyCapturer: false, useLegacyCapturer: false,
mobileMode: false, mobileMode: false,
@ -241,6 +242,7 @@ export interface Settings {
automaticPatches: boolean; automaticPatches: boolean;
alternativePaste: boolean; alternativePaste: boolean;
mods: string; mods: string;
dynamicIcon: boolean;
mobileMode: boolean; mobileMode: boolean;
skipSplash: boolean; skipSplash: boolean;
performanceMode: string; performanceMode: string;

View file

@ -140,7 +140,7 @@ async function doAfterDefiningTheWindow() {
(_, callback) => callback({cancel: true}) (_, callback) => callback({cancel: true})
); );
if ((await getConfig("trayIcon")) == "default") { if ((await getConfig("trayIcon")) == "default" || (await getConfig("dynamicIcon"))) {
mainWindow.webContents.on("page-favicon-updated", async (event) => { mainWindow.webContents.on("page-favicon-updated", async (event) => {
var faviconBase64 = await mainWindow.webContents.executeJavaScript(` var faviconBase64 = await mainWindow.webContents.executeJavaScript(`
var getFavicon = function(){ var getFavicon = function(){
@ -164,7 +164,11 @@ async function doAfterDefiningTheWindow() {
trayPath = trayPath.resize({height: 22}); trayPath = trayPath.resize({height: 22});
if (process.platform === "win32" && trayPath.getSize().height > 32) if (process.platform === "win32" && trayPath.getSize().height > 32)
trayPath = trayPath.resize({height: 32}); trayPath = trayPath.resize({height: 32});
if ((await getConfig("trayIcon")) == "default") {
tray.setImage(trayPath); tray.setImage(trayPath);
} else if (await getConfig("dynamicIcon")) {
mainWindow.setIcon(trayPath);
}
}); });
} }
const userDataPath = app.getPath("userData"); const userDataPath = app.getPath("userData");