mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-10 09:15:16 +00:00
Update with a proper comment
This commit is contained in:
@@ -76,5 +76,13 @@
|
|||||||
"bring_all_to_front": "Bring All to Front",
|
"bring_all_to_front": "Bring All to Front",
|
||||||
"label": "Window",
|
"label": "Window",
|
||||||
"zoom": "Zoom"
|
"zoom": "Zoom"
|
||||||
|
},
|
||||||
|
"icon_overlay": {
|
||||||
|
"description_notifications": {
|
||||||
|
"one": "You have %(count)s unread notification.",
|
||||||
|
"other": "You have %(count)s unread notifications."
|
||||||
|
},
|
||||||
|
"description_error": "Error"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
-15
@@ -12,21 +12,6 @@ import { randomArray } from "./utils.js";
|
|||||||
import { getDisplayMediaCallback, setDisplayMediaCallback } from "./displayMediaCallback.js";
|
import { getDisplayMediaCallback, setDisplayMediaCallback } from "./displayMediaCallback.js";
|
||||||
import Store, { clearDataAndRelaunch } from "./store.js";
|
import Store, { clearDataAndRelaunch } from "./store.js";
|
||||||
|
|
||||||
ipcMain.on(
|
|
||||||
"setBadgeCount",
|
|
||||||
function (_ev: IpcMainEvent, count: number, imageBuffer?: Buffer, imageBufferDescription?: string): void {
|
|
||||||
if (process.platform !== "win32") {
|
|
||||||
// only set badgeCount on Mac/Linux, the docs say that only those platforms support it but turns out Electron
|
|
||||||
// has some Windows support too, and in some Windows environments this leads to two badges rendering atop
|
|
||||||
// each other. See https://github.com/vector-im/element-web/issues/16942
|
|
||||||
app.badgeCount = count;
|
|
||||||
}
|
|
||||||
if (count === 0) {
|
|
||||||
global.mainWindow?.flashFrame(false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
let focusHandlerAttached = false;
|
let focusHandlerAttached = false;
|
||||||
ipcMain.on("loudNotification", function (): void {
|
ipcMain.on("loudNotification", function (): void {
|
||||||
if (process.platform === "win32" || process.platform === "linux") {
|
if (process.platform === "win32" || process.platform === "linux") {
|
||||||
|
|||||||
+16
-36
@@ -68,45 +68,25 @@ export function create(config: IConfig): void {
|
|||||||
initApplicationMenu();
|
initApplicationMenu();
|
||||||
trayIcon.on("click", toggleWin);
|
trayIcon.on("click", toggleWin);
|
||||||
|
|
||||||
if (process.platform === "win32") {
|
let lastFavicon: string | null = null;
|
||||||
// We only use setOverlayIcon on Windows as it's only supported on that platform, but has good support
|
global.mainWindow?.webContents.on("page-favicon-updated", async function (ev, favicons) {
|
||||||
// from all the Windows variants we support.
|
if (!favicons || favicons.length <= 0 || !favicons[0].startsWith("data:")) {
|
||||||
// https://www.electronjs.org/docs/latest/api/browser-window#winsetoverlayiconoverlay-description-windows
|
if (lastFavicon !== null) {
|
||||||
ipcMain.on(
|
global.mainWindow?.setIcon(defaultIcon);
|
||||||
"setBadgeCount",
|
trayIcon?.setImage(defaultIcon);
|
||||||
function (_ev: IpcMainEvent, count: number, imageBuffer?: Buffer, imageBufferDescription?: string): void {
|
lastFavicon = null;
|
||||||
if (imageBuffer && imageBufferDescription !== undefined) {
|
|
||||||
global.mainWindow?.setOverlayIcon(
|
|
||||||
nativeImage.createFromBuffer(Buffer.from(imageBuffer)),
|
|
||||||
imageBufferDescription,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
global.mainWindow?.setOverlayIcon(null, "");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// For other platforms, we instead update the application icon when the favicon changes.
|
|
||||||
let lastFavicon: string | null = null;
|
|
||||||
global.mainWindow?.webContents.on("page-favicon-updated", async function (ev, favicons) {
|
|
||||||
if (!favicons || favicons.length <= 0 || !favicons[0].startsWith("data:")) {
|
|
||||||
if (lastFavicon !== null) {
|
|
||||||
global.mainWindow?.setIcon(defaultIcon);
|
|
||||||
trayIcon?.setImage(defaultIcon);
|
|
||||||
lastFavicon = null;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// No need to change, shortcut
|
// No need to change, shortcut
|
||||||
if (favicons[0] === lastFavicon) return;
|
if (favicons[0] === lastFavicon) return;
|
||||||
lastFavicon = favicons[0];
|
lastFavicon = favicons[0];
|
||||||
|
|
||||||
const newFavicon = nativeImage.createFromDataURL(favicons[0]);
|
const newFavicon = nativeImage.createFromDataURL(favicons[0]);
|
||||||
trayIcon?.setImage(newFavicon);
|
trayIcon?.setImage(newFavicon);
|
||||||
global.mainWindow?.setIcon(newFavicon);
|
global.mainWindow?.setIcon(newFavicon);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
global.mainWindow?.webContents.on("page-title-updated", function (ev, title) {
|
global.mainWindow?.webContents.on("page-title-updated", function (ev, title) {
|
||||||
trayIcon?.setToolTip(title);
|
trayIcon?.setToolTip(title);
|
||||||
|
|||||||
Reference in New Issue
Block a user