From 52e5522f11d4895640801c70b2127a2df63cd454 Mon Sep 17 00:00:00 2001 From: Davilarek Date: Sat, 10 Jun 2023 19:31:14 +0200 Subject: [PATCH] Make the title more like in the official client (#404) --- src/window.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/window.ts b/src/window.ts index dfd1d30..e80e5ad 100644 --- a/src/window.ts +++ b/src/window.ts @@ -172,6 +172,16 @@ async function doAfterDefiningTheWindow(): Promise { mainWindow.setIcon(trayPath); } }); + + mainWindow.webContents.on("page-title-updated", async (e, title) => { + const armCordSuffix = " - ArmCord"; /* identify */ + if (!title.endsWith(armCordSuffix)) { + e.preventDefault(); + await mainWindow.webContents.executeJavaScript( + `document.title = '${(title.split(" | ")[1] ?? title) + armCordSuffix}'` + ); + } + }); } const userDataPath = app.getPath("userData"); const themesFolder = `${userDataPath}/themes/`;