diff --git a/.vscode/settings.json b/.vscode/settings.json index 53b335c4..e729f081 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -20,5 +20,6 @@ }, "[jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode" - } + }, + "cSpell.words": ["Vesktop"] } diff --git a/README.md b/README.md index d8c10a46..870a4353 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Vencord Desktop +# Vesktop -Vencord Desktop is a cross platform desktop app aiming to give you a snappier Discord experience with Vencord pre-installed +Vesktop is a cross platform desktop app aiming to give you a snappier Discord experience with Vencord pre-installed **Not yet supported**: - Global Keybinds @@ -13,11 +13,11 @@ Bug reports, feature requests & contributions are highly appreciated!! ### Windows -Download and run Vencord-Desktop-Setup-VERSION.exe from [releases](https://github.com/Vencord/Desktop/releases/latest) +Download and run Vesktop-Setup-VERSION.exe from [releases](https://github.com/Vencord/Vesktop/releases/latest) ### Mac -Download and run Vencord-Desktop-VERSION.dmg from [releases](https://github.com/Vencord/Desktop/releases/latest) +Download and run Vesktop-VERSION.dmg from [releases](https://github.com/Vencord/Vesktop/releases/latest) ### Linux @@ -27,15 +27,15 @@ Install [vencord-desktop-git](https://aur.archlinux.org/packages/vencord-desktop #### Ubuntu/Debian based -Download Vencord-Desktop-VERSION.deb from [releases](https://github.com/Vencord/Desktop/releases/latest) +Download Vesktop-VERSION.deb from [releases](https://github.com/Vencord/Vesktop/releases/latest) #### Fedora/RHEL based -Download Vencord-Desktop-VERSION.rpm from [releases](https://github.com/Vencord/Desktop/releases/latest) +Download Vesktop-VERSION.rpm from [releases](https://github.com/Vencord/Vesktop/releases/latest) #### Other -Either download Vencord-Desktop-VERSION.AppImage and just run it directly or grab Vencord-Desktop-VERSION.tar.gz, extract it somewhere and run `vencorddesktop`. +Either download Vesktop-VERSION.AppImage and just run it directly or grab Vesktop-VERSION.tar.gz, extract it somewhere and run `vencorddesktop`. A flatpak is planned, if you want packages for other repos, feel free to create them and they can be linked as unofficial here @@ -44,8 +44,8 @@ A flatpak is planned, if you want packages for other repos, feel free to create Packaging will create builds in the dist/ folder. You can then install them like mentioned above or distribute them ```sh -git clone https://github.com/Vencord/Desktop -cd Desktop +git clone https://github.com/Vencord/Vesktop +cd Vesktop # Install Dependencies pnpm i diff --git a/package.json b/package.json index 0e204d98..08fd7a06 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "VencordDesktop", - "version": "0.2.6", + "version": "0.2.7", "private": true, "description": "", "keywords": [], @@ -57,7 +57,7 @@ }, "build": { "appId": "dev.vencord.desktop", - "productName": "Vencord Desktop", + "productName": "Vesktop", "files": [ "!*", "dist/js", @@ -67,7 +67,7 @@ ], "linux": { "category": "Network", - "maintainer": "vendicated+vencord-desktop@riseup.net", + "maintainer": "vendicated+vesktop@riseup.net", "target": [ "deb", "tar.gz", @@ -75,7 +75,7 @@ "AppImage" ], "desktop": { - "Name": "Vencord Desktop", + "Name": "Vesktop", "GenericName": "Internet Messenger", "Type": "Application", "Categories": "Network;InstantMessaging;Chat;", diff --git a/scripts/build/build.mts b/scripts/build/build.mts index 5d2e0ee0..f210919a 100644 --- a/scripts/build/build.mts +++ b/scripts/build/build.mts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ @@ -54,7 +54,7 @@ await Promise.all([ }), createContext({ ...CommonOpts, - globalName: "VencordDesktop", + globalName: "Vesktop", entryPoints: ["src/renderer/index.ts"], outfile: "dist/js/renderer.js", format: "iife", @@ -65,7 +65,11 @@ await Promise.all([ tsconfig: "./scripts/build/tsconfig.esbuild.json", external: ["@vencord/types/*"], plugins: [vencordDep], - footer: { js: "//# sourceURL=VCDRenderer" } + // TODO: remove legacy name once main Vencord codebase has migrated and some time has passed. + // this 0 is very important. we run this script via webFrame.executeJavaScript and the last + // expression will be the return value. Without the 0, the return value would be Vesktop which + // leads to "An object could not be cloned" + footer: { js: ";window.VencordDesktop=Vesktop;0 \n//# sourceURL=VCDRenderer" } }) ]); diff --git a/scripts/build/injectReact.mjs b/scripts/build/injectReact.mjs index 0f1bba2b..f9ce52b1 100644 --- a/scripts/build/injectReact.mjs +++ b/scripts/build/injectReact.mjs @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/scripts/build/vencordDep.mts b/scripts/build/vencordDep.mts index d0c87cea..d2859409 100644 --- a/scripts/build/vencordDep.mts +++ b/scripts/build/vencordDep.mts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/scripts/header.txt b/scripts/header.txt index 568e18ae..9fdad8f1 100644 --- a/scripts/header.txt +++ b/scripts/header.txt @@ -1,5 +1,5 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/scripts/start.ts b/scripts/start.ts index c2cc154e..afe3f757 100644 --- a/scripts/start.ts +++ b/scripts/start.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/scripts/startWatch.mts b/scripts/startWatch.mts index 1f724437..4a6f2e55 100644 --- a/scripts/startWatch.mts +++ b/scripts/startWatch.mts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/scripts/utils/dotenv.ts b/scripts/utils/dotenv.ts index 73afb645..1dd697f5 100644 --- a/scripts/utils/dotenv.ts +++ b/scripts/utils/dotenv.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/scripts/utils/spawn.mts b/scripts/utils/spawn.mts index 2d2f2a91..a2c0a5f7 100644 --- a/scripts/utils/spawn.mts +++ b/scripts/utils/spawn.mts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/src/globals.d.ts b/src/globals.d.ts index d05fe1bc..4d39c4c7 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -1,12 +1,12 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ declare global { - export var VencordDesktopNative: typeof import("preload/VencordDesktopNative").VencordDesktopNative; - export var VencordDesktop: typeof import("renderer/index"); + export var VesktopNative: typeof import("preload/VesktopNative").VesktopNative; + export var Vesktop: typeof import("renderer/index"); export var VCDP: any; export var IS_DEV: boolean; diff --git a/src/main/about.ts b/src/main/about.ts index 84ac4ad1..4d9f5415 100644 --- a/src/main/about.ts +++ b/src/main/about.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/src/main/appBadge.ts b/src/main/appBadge.ts index 2887498d..0167600b 100644 --- a/src/main/appBadge.ts +++ b/src/main/appBadge.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/src/main/arrpc.ts b/src/main/arrpc.ts index 16194d4b..e0fd023f 100644 --- a/src/main/arrpc.ts +++ b/src/main/arrpc.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ @@ -29,7 +29,7 @@ export async function initArRPC() { mainWin.webContents // Safety: Result of JSON.stringify should always be safe to equal // Also, just to be super super safe, invite is regex validated above - .executeJavaScript(`VencordDesktop.openInviteModal(${JSON.stringify(invite)})`) + .executeJavaScript(`Vesktop.openInviteModal(${JSON.stringify(invite)})`) .then(callback); }); } catch (e) { diff --git a/src/main/autoStart.ts b/src/main/autoStart.ts index 1a31b07c..fbbc30ec 100644 --- a/src/main/autoStart.ts +++ b/src/main/autoStart.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/src/main/constants.ts b/src/main/constants.ts index c53a758f..8c30b033 100644 --- a/src/main/constants.ts +++ b/src/main/constants.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ @@ -17,7 +17,7 @@ export const VENCORD_SETTINGS_FILE = join(VENCORD_SETTINGS_DIR, "settings.json") export const VENCORD_FILES_DIR = (require("./settings") as typeof import("./settings")).Settings.store.vencordDir || join(DATA_DIR, "vencordDist"); -export const USER_AGENT = `VencordDesktop/${app.getVersion()} (https://github.com/Vencord/Desktop)`; +export const USER_AGENT = `Vesktop/${app.getVersion()} (https://github.com/Vencord/Vesktop)`; // dimensions shamelessly stolen from Discord Desktop :3 export const MIN_WIDTH = 940; diff --git a/src/main/firstLaunch.ts b/src/main/firstLaunch.ts index b91784e6..b65b930b 100644 --- a/src/main/firstLaunch.ts +++ b/src/main/firstLaunch.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/src/main/index.ts b/src/main/index.ts index 8af9561a..10552f23 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ @@ -59,10 +59,10 @@ function init() { if (!app.requestSingleInstanceLock({ IS_DEV })) { if (IS_DEV) { - console.log("Vencord Desktop is already running. Quitting previous instance..."); + console.log("Vesktop is already running. Quitting previous instance..."); init(); } else { - console.log("Vencord Desktop is already running. Quitting..."); + console.log("Vesktop is already running. Quitting..."); app.quit(); } } else { diff --git a/src/main/ipc.ts b/src/main/ipc.ts index c073c68b..10181d24 100644 --- a/src/main/ipc.ts +++ b/src/main/ipc.ts @@ -1,12 +1,13 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ import { app, dialog, ipcMain, session, shell } from "electron"; import { existsSync, readFileSync, watch } from "fs"; import { open, readFile } from "fs/promises"; +import { release } from "os"; import { join } from "path"; import { debounce } from "shared/utils/debounce"; @@ -41,6 +42,10 @@ ipcMain.on(IpcEvents.GET_VERSION, e => { e.returnValue = app.getVersion(); }); +ipcMain.on(IpcEvents.SUPPORTS_WINDOWS_TRANSPARENCY, e => { + e.returnValue = process.platform === "win32" && Number(release().split(".").pop()) >= 22621; +}); + ipcMain.on(IpcEvents.AUTOSTART_ENABLED, e => { e.returnValue = autoStart.isEnabled(); }); diff --git a/src/main/mainWindow.ts b/src/main/mainWindow.ts index 4e115a10..65b70d2a 100644 --- a/src/main/mainWindow.ts +++ b/src/main/mainWindow.ts @@ -1,19 +1,29 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ -import { app, BrowserWindow, BrowserWindowConstructorOptions, Menu, Tray } from "electron"; +import { + app, + BrowserWindow, + BrowserWindowConstructorOptions, + dialog, + Menu, + MenuItemConstructorOptions, + Tray +} from "electron"; +import { rm } from "fs/promises"; import { join } from "path"; import { IpcEvents } from "shared/IpcEvents"; +import { isTruthy } from "shared/utils/guards"; import { once } from "shared/utils/once"; import type { SettingsStore } from "shared/utils/SettingsStore"; import { ICON_PATH } from "../shared/paths"; import { createAboutWindow } from "./about"; import { initArRPC } from "./arrpc"; -import { DEFAULT_HEIGHT, DEFAULT_WIDTH, MIN_HEIGHT, MIN_WIDTH, VENCORD_FILES_DIR } from "./constants"; +import { DATA_DIR, DEFAULT_HEIGHT, DEFAULT_WIDTH, MIN_HEIGHT, MIN_WIDTH, VENCORD_FILES_DIR } from "./constants"; import { Settings, VencordSettings } from "./settings"; import { createSplashWindow } from "./splash"; import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally"; @@ -70,6 +80,12 @@ function initTray(win: BrowserWindow) { app.quit(); } }, + { + label: "Reset Vesktop", + async click() { + await clearData(win); + } + }, { type: "separator" }, @@ -81,7 +97,7 @@ function initTray(win: BrowserWindow) { } }, { - label: "Quit Vencord Desktop", + label: "Quit Vesktop", click() { isQuitting = true; app.quit(); @@ -90,7 +106,7 @@ function initTray(win: BrowserWindow) { ]); tray = new Tray(ICON_PATH); - tray.setToolTip("Vencord Desktop"); + tray.setToolTip("Vesktop"); tray.setContextMenu(trayMenu); tray.on("click", () => win.show()); @@ -103,62 +119,107 @@ function initTray(win: BrowserWindow) { }); } +const enum MessageBoxChoice { + Default, + Cancel +} + +async function clearData(win: BrowserWindow) { + const { response } = await dialog.showMessageBox(win, { + message: "Are you sure you want to reset Vesktop?", + detail: "This will log you out, clear caches and reset all your settings!\n\nVesktop will automatically restart after this operation.", + buttons: ["Yes", "No"], + cancelId: MessageBoxChoice.Cancel, + defaultId: MessageBoxChoice.Default, + type: "warning" + }); + + if (response === MessageBoxChoice.Cancel) return; + + win.close(); + + await win.webContents.session.clearStorageData(); + await win.webContents.session.clearCache(); + await win.webContents.session.clearCodeCaches({}); + await rm(DATA_DIR, { force: true, recursive: true }); + + app.relaunch(); + app.quit(); +} + function initMenuBar(win: BrowserWindow) { const isWindows = process.platform === "win32"; + const isDarwin = process.platform === "darwin"; const wantCtrlQ = !isWindows || VencordSettings.store.winCtrlQ; + const subMenu = [ + { + label: "About Vesktop", + click: createAboutWindow + }, + { + label: "Force Update Vencord", + async click() { + await downloadVencordFiles(); + app.relaunch(); + app.quit(); + }, + toolTip: "Vesktop will automatically restart after this operation" + }, + { + label: "Reset Vesktop", + async click() { + await clearData(win); + }, + toolTip: "Vesktop will automatically restart after this operation" + }, + { + label: "Relaunch", + accelerator: "CmdOrCtrl+Shift+R", + click() { + app.relaunch(); + app.quit(); + } + }, + isDarwin && { + label: "Hide", + role: "hide" + }, + isDarwin && { + label: "Hide others", + role: "hideOthers" + }, + { + label: "Quit", + accelerator: wantCtrlQ ? "CmdOrCtrl+Q" : void 0, + visible: !isWindows, + role: "quit", + click() { + app.quit(); + } + }, + isWindows && { + label: "Quit", + accelerator: "Alt+F4", + role: "quit", + 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 + } + ] satisfies Array; + const menu = Menu.buildFromTemplate([ { - label: "Vencord Desktop", + label: "Vesktop", role: "appMenu", - submenu: [ - { - label: "About Vencord Desktop", - click: createAboutWindow - }, - { - label: "Force Update Vencord", - async click() { - await downloadVencordFiles(); - app.relaunch(); - app.quit(); - }, - toolTip: "Vencord Desktop will automatically restart after this operation" - }, - { - label: "Relaunch", - accelerator: "CmdOrCtrl+Shift+R", - click() { - app.relaunch(); - app.quit(); - } - }, - { - label: "Quit", - accelerator: wantCtrlQ ? "CmdOrCtrl+Q" : void 0, - visible: !isWindows, - role: "quit", - click() { - app.quit(); - } - }, - { - label: "Quit", - accelerator: isWindows ? "Alt+F4" : void 0, - visible: isWindows, - role: "quit", - 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 - } - ] + submenu: subMenu.filter(isTruthy) }, { role: "fileMenu" }, { role: "editMenu" }, @@ -250,6 +311,8 @@ function createMainWindow() { removeSettingsListeners(); removeVencordSettingsListeners(); + const { staticTitle, transparencyOption } = Settings.store; + const { frameless, macosTranslucency } = VencordSettings.store; const win = (mainWin = new BrowserWindow({ show: false, webPreferences: { @@ -261,23 +324,34 @@ function createMainWindow() { spellcheck: true }, icon: ICON_PATH, - frame: VencordSettings.store.frameless !== true, - ...(Settings.store.staticTitle ? { title: "Vencord" } : {}), - ...(VencordSettings.store.macosTranslucency + frame: frameless !== true, + ...(transparencyOption && transparencyOption !== "none" + ? { + backgroundColor: "#00000000", + backgroundMaterial: Settings.store.transparencyOption, + transparent: true + } + : {}), + ...(staticTitle ? { title: "Vencord" } : {}), + ...(macosTranslucency ? { vibrancy: "sidebar", backgroundColor: "#ffffff00" } : {}), + ...(process.platform === "darwin" ? { titleBarStyle: "hiddenInset" } : {}), ...getWindowBoundsOptions() })); win.setMenuBarVisibility(false); win.on("close", e => { - if (isQuitting || Settings.store.minimizeToTray === false || Settings.store.tray === false) return; + const useTray = Settings.store.minimizeToTray !== false && Settings.store.tray !== false; + if (isQuitting || (process.platform !== "darwin" && !useTray)) return; e.preventDefault(); - win.hide(); + + if (process.platform === "darwin") app.hide(); + else win.hide(); return false; }); @@ -285,7 +359,7 @@ function createMainWindow() { if (Settings.store.staticTitle) win.on("page-title-updated", e => e.preventDefault()); initWindowBoundsListeners(win); - if (Settings.store.tray ?? true) initTray(win); + if ((Settings.store.tray ?? true) && process.platform !== "darwin") initTray(win); initMenuBar(win); makeLinksOpenExternally(win); initSettingsListeners(win); diff --git a/src/main/screenShare.ts b/src/main/screenShare.ts index f04053f8..37ce4cd4 100644 --- a/src/main/screenShare.ts +++ b/src/main/screenShare.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ @@ -36,7 +36,7 @@ export function registerScreenShareHandler() { })); const choice = await request.frame - .executeJavaScript(`VencordDesktop.Components.ScreenShare.openScreenSharePicker(${JSON.stringify(data)})`) + .executeJavaScript(`Vesktop.Components.ScreenShare.openScreenSharePicker(${JSON.stringify(data)})`) .then(e => e as StreamPick) .catch(() => null); diff --git a/src/main/settings.ts b/src/main/settings.ts index dfb74740..6fad97fa 100644 --- a/src/main/settings.ts +++ b/src/main/settings.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ @@ -33,5 +33,5 @@ function loadSettings(file: string, name: string) { return store; } -export const Settings = loadSettings(SETTINGS_FILE, "Vencord Desktop"); +export const Settings = loadSettings(SETTINGS_FILE, "Vesktop"); export const VencordSettings = loadSettings(VENCORD_SETTINGS_FILE, "Vencord"); diff --git a/src/main/splash.ts b/src/main/splash.ts index 728c6883..bf910fbc 100644 --- a/src/main/splash.ts +++ b/src/main/splash.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/src/main/utils/http.ts b/src/main/utils/http.ts index fc504107..9a983849 100644 --- a/src/main/utils/http.ts +++ b/src/main/utils/http.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/src/main/utils/makeLinksOpenExternally.ts b/src/main/utils/makeLinksOpenExternally.ts index 4da49691..b30b865a 100644 --- a/src/main/utils/makeLinksOpenExternally.ts +++ b/src/main/utils/makeLinksOpenExternally.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/src/main/utils/vencordLoader.ts b/src/main/utils/vencordLoader.ts index 0d88841d..18a22116 100644 --- a/src/main/utils/vencordLoader.ts +++ b/src/main/utils/vencordLoader.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/src/preload/VencordDesktopNative.ts b/src/preload/VesktopNative.ts similarity index 90% rename from src/preload/VencordDesktopNative.ts rename to src/preload/VesktopNative.ts index 6f0f402f..6a4415a8 100644 --- a/src/preload/VencordDesktopNative.ts +++ b/src/preload/VesktopNative.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ @@ -19,11 +19,12 @@ ipcRenderer.on(IpcEvents.SPELLCHECK_RESULT, (_, w: string, s: string[]) => { spellCheckCallbacks.forEach(cb => cb(w, s)); }); -export const VencordDesktopNative = { +export const VesktopNative = { app: { relaunch: () => invoke(IpcEvents.RELAUNCH), getVersion: () => sendSync(IpcEvents.GET_VERSION), - setBadgeCount: (count: number) => invoke(IpcEvents.SET_BADGE_COUNT, count) + setBadgeCount: (count: number) => invoke(IpcEvents.SET_BADGE_COUNT, count), + supportsWindowsTransparency: () => sendSync(IpcEvents.SUPPORTS_WINDOWS_TRANSPARENCY) }, autostart: { isEnabled: () => sendSync(IpcEvents.AUTOSTART_ENABLED), diff --git a/src/preload/index.ts b/src/preload/index.ts index 5b40c2e2..6eb36fac 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ @@ -8,9 +8,11 @@ import { contextBridge, ipcRenderer, webFrame } from "electron"; import { readFileSync, watch } from "fs"; import { IpcEvents } from "../shared/IpcEvents"; -import { VencordDesktopNative } from "./VencordDesktopNative"; +import { VesktopNative } from "./VesktopNative"; -contextBridge.exposeInMainWorld("VencordDesktopNative", VencordDesktopNative); +contextBridge.exposeInMainWorld("VesktopNative", VesktopNative); +// TODO: remove legacy alias once main Vencord codebase has migrated and some time has passed +contextBridge.exposeInMainWorld("VencordDesktopNative", VesktopNative); require(ipcRenderer.sendSync(IpcEvents.GET_VENCORD_PRELOAD_FILE)); @@ -41,4 +43,4 @@ if (IS_DEV) { } // #endregion -VencordDesktopNative.spellcheck.setLanguages(window.navigator.languages); +VesktopNative.spellcheck.setLanguages(window.navigator.languages); diff --git a/src/preload/typedIpc.ts b/src/preload/typedIpc.ts index 6522de6e..e8b519c8 100644 --- a/src/preload/typedIpc.ts +++ b/src/preload/typedIpc.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ diff --git a/src/renderer/appBadge.ts b/src/renderer/appBadge.ts index ea40b603..de46701e 100644 --- a/src/renderer/appBadge.ts +++ b/src/renderer/appBadge.ts @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ @@ -23,7 +23,7 @@ export function setBadge() { let totalCount = mentionCount + pendingRequests; if (!totalCount && hasUnread && !disableUnreadBadge) totalCount = -1; - VencordDesktopNative.app.setBadgeCount(totalCount); + VesktopNative.app.setBadgeCount(totalCount); } let toFind = 3; diff --git a/src/renderer/components/ScreenSharePicker.tsx b/src/renderer/components/ScreenSharePicker.tsx index 4533a765..bd7083cb 100644 --- a/src/renderer/components/ScreenSharePicker.tsx +++ b/src/renderer/components/ScreenSharePicker.tsx @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ @@ -118,7 +118,7 @@ function StreamSettings({ settings: StreamSettings; setSettings: Dispatch>; }) { - const [thumb] = useAwaiter(() => VencordDesktopNative.capturer.getLargeThumbnail(source.id), { + const [thumb] = useAwaiter(() => VesktopNative.capturer.getLargeThumbnail(source.id), { fallbackValue: source.url, deps: [source.id] }); diff --git a/src/renderer/components/Settings.tsx b/src/renderer/components/Settings.tsx index bf915b04..dcb2a648 100644 --- a/src/renderer/components/Settings.tsx +++ b/src/renderer/components/Settings.tsx @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience + * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ @@ -13,16 +13,17 @@ import { useSettings } from "renderer/settings"; export default function SettingsUi() { const Settings = useSettings(); + const supportsWindowsTransparency = VesktopNative.app.supportsWindowsTransparency(); - const { autostart } = VencordDesktopNative; + const { autostart } = VesktopNative; const [autoStartEnabled, setAutoStartEnabled] = useState(autostart.isEnabled()); const switches: [keyof typeof Settings, string, string, boolean?, (() => boolean)?][] = [ - ["tray", "Tray Icon", "Add a tray icon for Vencord Desktop", true], + ["tray", "Tray Icon", "Add a tray icon for Vesktop", true], [ "minimizeToTray", "Minimize to tray", - "Hitting X will make Vencord Desktop minimize to the tray instead of closing", + "Hitting X will make Vesktop minimize to the tray instead of closing", true, () => Settings.tray ?? true ], @@ -35,7 +36,7 @@ export default function SettingsUi() { [ "openLinksWithElectron", "Open Links in app (experimental)", - "Opens links in a new Vencord Desktop window instead of your web browser" + "Opens links in a new Vesktop window instead of your web browser" ], ["staticTitle", "Static Title", 'Makes the window title "Vencord" instead of changing to the current page'] ]; @@ -43,10 +44,10 @@ export default function SettingsUi() { return ( - Vencord Desktop Settings + Vesktop Settings - Discord Branch + Discord Branch (Settings.transparencyOption = v)} + isSelected={v => v === Settings.transparencyOption} + serialize={s => s} + /> + + + + )} + Vencord Location Vencord files are loaded from{" "} @@ -105,7 +143,7 @@ export default function SettingsUi() { href="about:blank" onClick={e => { e.preventDefault(); - VencordDesktopNative.fileManager.showItemInFolder(Settings.vencordDir!); + VesktopNative.fileManager.showItemInFolder(Settings.vencordDir!); }} > {Settings.vencordDir} @@ -118,7 +156,7 @@ export default function SettingsUi() {