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-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-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-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!",

View file

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

View file

@ -104,6 +104,14 @@
</div>
<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">
<select name="channel" data-setting="channel" class="left dropdown">
<option value="stable" selected>Stable</option>

View file

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

View file

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