From fe70701de8773e2ce7d53b8afe93e057288ec1be Mon Sep 17 00:00:00 2001 From: Vendicated Date: Thu, 27 Apr 2023 02:23:17 +0200 Subject: [PATCH] Fix zoom & about menu items; add version to about page --- src/main/about.ts | 7 +++++-- src/main/mainWindow.ts | 22 ++++++++-------------- static/about.html | 2 +- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/main/about.ts b/src/main/about.ts index 4daf965..a335b85 100644 --- a/src/main/about.ts +++ b/src/main/about.ts @@ -4,7 +4,8 @@ * Copyright (c) 2023 Vendicated and Vencord contributors */ -import { BrowserWindow } from "electron"; +import { app, BrowserWindow } from "electron"; +import { readFileSync } from "fs"; import { join } from "path"; import { ICON_PATH, STATIC_DIR } from "shared/paths"; @@ -19,7 +20,9 @@ export function createAboutWindow() { makeLinksOpenExternally(about); - about.loadFile(join(STATIC_DIR, "about.html")); + const html = readFileSync(join(STATIC_DIR, "about.html"), "utf-8").replaceAll("%VERSION%", app.getVersion()); + + about.loadURL("data:text/html;charset=utf-8," + html); return about; } diff --git a/src/main/mainWindow.ts b/src/main/mainWindow.ts index d8ad3b1..35c6297 100644 --- a/src/main/mainWindow.ts +++ b/src/main/mainWindow.ts @@ -88,7 +88,6 @@ function initMenuBar(win: BrowserWindow) { submenu: [ { label: "About Vencord Desktop", - role: "about", click: createAboutWindow }, { @@ -125,25 +124,20 @@ function initMenuBar(win: BrowserWindow) { click() { app.quit(); } + }, + // See https://github.com/electron/electron/issues/14742 and https://github.com/electron/electron/issues/5256 + { + label: "Zoom in (hidden, hack for Qwertz and others)", + accelerator: "CmdOrCtrl+=", + role: "zoomIn", + visible: false } ] }, { role: "fileMenu" }, { role: "editMenu" }, { role: "viewMenu" }, - { role: "windowMenu" }, - { - label: "Zoom", - submenu: [ - // See https://github.com/electron/electron/issues/14742 and https://github.com/electron/electron/issues/5256 - { - label: "Zoom in", - accelerator: "CmdOrCtrl+=", - role: "zoomIn" - } - ], - visible: false - } + { role: "windowMenu" } ]); Menu.setApplicationMenu(menu); diff --git a/static/about.html b/static/about.html index 5e1d694..abe01e2 100644 --- a/static/about.html +++ b/static/about.html @@ -13,7 +13,7 @@ -

About Vencord Desktop

+

Vencord Desktop %VERSION%

Vencord Desktop is a free/libre cross platform desktop app aiming to give you a snappier Discord experience with Vencord pre-installed