48 Commits

Author SHA1 Message Date
Vendicated
4a2d12f273 fix lockfile 2025-07-08 01:08:39 +02:00
Vendicated
3498e39cbb bump to v1.5.8 2025-07-08 01:02:17 +02:00
Vendicated
3278b16923 Remove GTK mixed symbols workaround
This bug is fixed in electron 37, so the workaround is no longer needed
2025-07-06 19:16:07 +02:00
Vendicated
fde447bc1d improve about window 2025-07-06 18:57:57 +02:00
Vendicated
4baf6de472 arrpc: fix link handling 2025-07-06 17:54:58 +02:00
Justin
8aa91b4f01 Move arrpc server into a worker thread to reduce stutters (#1053)
Co-authored-by: V <vendicated@riseup.net>
2025-07-06 17:34:32 +02:00
Vendicated
099845deb7 bump electron again surely this time they fixed every bug 2025-07-06 16:27:04 +02:00
Vendicated
3982e122a7 upgrade to electron 37 2025-06-27 23:08:50 +02:00
Cookie
8d3c9390ae update discord css variable name (#1164) 2025-06-27 03:09:33 +02:00
Vendicated
236fc806de fake markdown wtf 2025-06-26 15:09:35 +02:00
Vendicated
2dcebeca79 revise issue template once again 2025-06-26 15:08:28 +02:00
Vendicated
e6589eacfc fix lockfile 2025-06-21 04:12:21 +02:00
Vendicated
29d1c73d81 okay pnpm 2025-06-21 04:10:45 +02:00
Vendicated
26906b9776 patch electron-updater to fix rpm updater 2025-06-21 04:06:13 +02:00
Vendicated
36c67aa54a bump dependencies 2025-06-21 04:06:00 +02:00
Cookie
3cd4e94762 fix spellcheck (#1163) 2025-06-20 19:29:13 +02:00
Vendicated
6950e0b03a add comment explaining the patch 2025-06-10 17:22:30 +02:00
Vendicated
f98309c7b7 fix random logouts (Discord shitcode moment) 2025-06-10 17:16:26 +02:00
Vendicated
a2dade9140 i am very stupid 2025-06-09 01:36:45 +02:00
Vendicated
83ad4970e5 fix Video HWA wrongly being disabled if HWA setting was never changed 2025-06-09 01:36:15 +02:00
Vending Machine
f123f5fc3c Update dev.vencord.Vesktop.metainfo.xml 2025-06-08 22:07:07 +02:00
Vending Machine
0a856b26da Update meta.yml 2025-06-08 22:04:59 +02:00
Vendicated
dad306a4b5 bump to v1.5.7 2025-06-08 21:47:06 +02:00
Vendicated
a52ee1dbb6 bump dependencies 2025-06-08 21:45:17 +02:00
Vendicated
524f8ff277 ipcCommands: check if mainWin is alive 2025-06-08 21:39:56 +02:00
Vendicated
83104e3625 fix discord titlebar buttons missing 2025-06-08 21:34:31 +02:00
Vendicated
fcb61c8f42 improve handling of no hardware acceleration 2025-06-08 21:21:57 +02:00
Vendicated
48e9aea47e add hardware video acceleration switch & improve settings ui 2025-06-08 20:56:28 +02:00
Vendicated
6e7d912b95 make linux screenshare audio stereo 2025-05-20 01:45:24 +02:00
Vendicated
475012cbed bump electron patch 2025-05-16 22:30:11 +02:00
Vendicated
382dac96f7 fix return value 2025-05-16 21:01:19 +02:00
Vendicated
3295a7d344 migrate executeJavaScript calls to new command system 2025-05-16 21:00:32 +02:00
Vendicated
bb3cec0d13 Fix Invalid URL error 2025-05-16 20:48:34 +02:00
Vendicated
1a673f2318 build: automatically glob all patch files 2025-05-16 20:43:27 +02:00
Vendicated
d9a7e81f71 switch to node inbuilt source map support 2025-05-16 19:59:29 +02:00
Vendicated
73848311b1 oh cookie what are u doing 2025-05-16 19:52:16 +02:00
Vendicated
857779e77b remove legacy code 2025-05-16 19:47:10 +02:00
William
fa627b384f add StartupWMClass - fixes AppImage icon & pinning (#1158)
Co-authored-by: Vending Machine <vendicated@riseup.net>
2025-05-16 19:38:02 +02:00
Cookie
43a8781492 Link Discord connections through the browser instead of a popup (#1159)
Co-authored-by: Vending Machine <vendicated@riseup.net>
2025-05-16 19:34:48 +02:00
Vendicated
b17fef93ba make Discord's auto gain control toggle actually work 2025-05-16 03:37:32 +02:00
Vendicated
fc16fc5404 Fix not launching on GNOME
Reference: https://github.com/electron/electron/issues/46538
Also improves the chromium switch code
2025-05-14 05:26:29 +02:00
Vendicated
e760e58ed7 upgrade to electron 36 2025-05-14 05:26:29 +02:00
Cookie
3936a0a41e fix: handle loadURL() failures correctly (#1093) 2025-04-22 22:03:17 +02:00
Glitchtest
c7d830c57c Revert loopbackWithMute to loopback (#1155)
apparently loopbackWithMute does not mute your own app like initially assumed but rather mutes the system audio for the user
2025-04-17 23:23:42 +02:00
Vendicated
7bf05bd907 add back window menu (minimise, close, etc) on mac 2025-04-17 14:39:19 +02:00
Vending Machine
ae20445301 manually update metainfo 2025-04-13 14:49:49 +02:00
Vending Machine
33d1ac43e3 fix meta.yml 2025-04-13 14:47:32 +02:00
Vending Machine
da51ebb0a7 fix(ci): strip v prefix from version in vencord.dev updater 2025-04-13 14:44:27 +02:00
60 changed files with 1386 additions and 713 deletions

View File

@@ -5,4 +5,4 @@
# https://github.com/settings/personal-access-tokens/new
GITHUB_TOKEN=
ELECTRON_LAUNCH_FLAGS="--ozone-platform-hint=auto --enable-webrtc-pipewire-capturer --enable-features=WaylandWindowDecorations"
ELECTRON_LAUNCH_FLAGS="--enable-source-maps --ozone-platform-hint=auto"

View File

@@ -5,8 +5,13 @@ body:
- type: markdown
attributes:
value: |
![Are you a developer? No? This form is not for you!](https://github.com/Vencord/Vesktop/blob/main/.github/ISSUE_TEMPLATE/developer-banner.png?raw=true)
GitHub Issues are for developers, not support. Please use our [support server](https://vencord.dev/discord) if you are not a developer.
# This form is reserved for Vesktop Developers. Do not open an issue.
Instead, use the [#vesktop-support channel](https://discord.com/channels/1015060230222131221/1345457031426871417) on our [Discord server](https://vencord.dev/discord) for help and reporting issues.
Your issue will be closed immediately with no comment and you will be blocked if you ignore this.
This is because 99% of issues are not actually bugs, but rather user or system issues and it adds a lot of noise to our development process.
- type: textarea
id: content
attributes:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -37,6 +37,6 @@ jobs:
git add meta/dev.vencord.Vesktop.metainfo.xml
git commit -m "metainfo: add entry for ${{ github.event.release.tag_name }}"
git push origin main
git push origin HEAD:main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -17,7 +17,8 @@ jobs:
git clone https://$USERNAME:$API_TOKEN@github.com/$GH_REPO.git repo
cd repo
echo "${{ github.event.release.tag_name }}" > scripts/_latestVesktopVersion.txt
version="${{ github.event.release.tag_name }}"
echo "${version#v}" > scripts/_latestVesktopVersion.txt
git add scripts/_latestVesktopVersion.txt
git commit -m "Update Vesktop version to ${{ github.event.release.tag_name }}"

View File

@@ -28,6 +28,37 @@
</screenshot>
</screenshots>
<releases>
<release version="1.5.7" date="2025-06-08" type="stable">
<url>https://github.com/Vencord/Vesktop/releases/tag/v1.5.7</url>
<description>
<p>What's Changed</p>
<ul>
<li>Starting a screenshare on Windows will no longer mute system audio</li>
<li>Fixed showing "Invalid URL" errors in some edge cases (spotty network)</li>
<li>Now respects your Autogain preference</li>
<li>Improved the flow for linking third party accounts</li>
<li>Fixed issue that would cause the AppImage to have no icon and be unpinnable</li>
<li>Added the ability to screenshare with stereo audio</li>
<li>Added Video Hardware Acceleration switch - Used to always be enabled. Now it is opt-in (disabled by default) to fix graphical glitches that were affecting many users</li>
<li>Fixed Discord titlebar buttons</li>
<li>Fixed "Object has been destroyed" error in some edge cases</li>
</ul>
</description>
</release>
<release version="1.5.6" date="2025-04-13" type="stable">
<url>https://github.com/Vencord/Vesktop/releases/tag/v1.5.6</url>
<description>
<p>What's Changed</p>
<ul>
<li>Fixes the new Discord titlebar @Sqaaakoi</li>
<li>Fixes Clipboard copy actions not working</li>
<li>Should now properly hide the "Download Apps" button again</li>
<li>No longer responds to Browser Tab shortcuts like Ctrl+W by @rushiiMachine</li>
<li>DevTools keybind should now work properly on Mac @ryanccn</li>
<li>Should no longer throw Sandbox errors on Ubuntu</li>
</ul>
</description>
</release>
<release version="1.5.5" date="2025-02-06" type="stable">
<url>https://github.com/Vencord/Vesktop/releases/tag/v1.5.5</url>
<description>
@@ -264,4 +295,4 @@
<keyword>Privacy</keyword>
<keyword>Mod</keyword>
</keywords>
</component>
</component>

View File

@@ -1,6 +1,6 @@
{
"name": "vesktop",
"version": "1.5.6",
"version": "1.5.8",
"private": true,
"description": "Vesktop is a custom Discord desktop app",
"keywords": [],
@@ -34,28 +34,28 @@
},
"devDependencies": {
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
"@stylistic/eslint-plugin": "^4.2.0",
"@types/node": "^22.13.17",
"@stylistic/eslint-plugin": "^5.1.0",
"@types/node": "^24.0.10",
"@types/react": "18.3.1",
"@vencord/types": "^1.11.5",
"dotenv": "^16.4.7",
"electron": "^35.1.5",
"dotenv": "^16.5.0",
"electron": "^37.2.0",
"electron-builder": "^26.0.12",
"esbuild": "^0.25.2",
"eslint": "^9.23.0",
"esbuild": "^0.25.5",
"eslint": "^9.30.1",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-path-alias": "^2.1.0",
"eslint-plugin-prettier": "^5.2.5",
"eslint-plugin-prettier": "^5.5.1",
"eslint-plugin-simple-header": "^1.2.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unused-imports": "^4.1.4",
"prettier": "^3.5.3",
"prettier": "^3.6.2",
"source-map-support": "^0.5.21",
"tsx": "^4.19.3",
"type-fest": "^4.39.0",
"typescript": "^5.8.2",
"typescript-eslint": "^8.29.0",
"xml-formatter": "^3.6.5"
"tsx": "^4.20.3",
"type-fest": "^4.41.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.35.1",
"xml-formatter": "^3.6.6"
},
"packageManager": "pnpm@10.7.1",
"engines": {
@@ -121,7 +121,8 @@
"Type": "Application",
"Categories": "Network;InstantMessaging;Chat;",
"Keywords": "discord;vencord;electron;chat;",
"MimeType": "x-scheme-handler/discord"
"MimeType": "x-scheme-handler/discord",
"StartupWMClass": "vesktop"
}
}
},
@@ -198,7 +199,8 @@
},
"pnpm": {
"patchedDependencies": {
"arrpc@3.5.0": "patches/arrpc@3.5.0.patch"
"arrpc@3.5.0": "patches/arrpc@3.5.0.patch",
"electron-updater": "patches/electron-updater.patch"
},
"onlyBuiltDependencies": [
"@vencord/venmic",

View File

@@ -0,0 +1,16 @@
diff --git a/out/RpmUpdater.js b/out/RpmUpdater.js
index 563187bb18cb0bd154dff6620cb62b8c8f534cd6..d91594026c2bac9cc78ef3b1183df3241d7d9624 100644
--- a/out/RpmUpdater.js
+++ b/out/RpmUpdater.js
@@ -32,7 +32,10 @@ class RpmUpdater extends BaseUpdater_1.BaseUpdater {
const sudo = this.wrapSudo();
// pkexec doesn't want the command to be wrapped in " quotes
const wrapper = /pkexec/i.test(sudo) ? "" : `"`;
- const packageManager = this.spawnSyncLog("which zypper");
+ let packageManager;
+ try {
+ packageManager = this.spawnSyncLog("which zypper");
+ } catch {}
const installerPath = this.installerPath;
if (installerPath == null) {
this.dispatchError(new Error("No valid update available, can't quit and install"));

1011
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,7 @@ import { BuildContext, BuildOptions, context } from "esbuild";
import { copyFile } from "fs/promises";
import vencordDep from "./vencordDep.mjs";
import { includeDirPlugin } from "./includeDirPlugin.mts";
const isDev = process.argv.includes("--dev");
@@ -57,12 +58,23 @@ await Promise.all([
outfile: "dist/js/main.js",
footer: { js: "//# sourceURL=VCDMain" }
}),
createContext({
...NodeCommonOpts,
entryPoints: ["src/main/arrpc/worker.ts"],
outfile: "dist/js/arRpcWorker.js",
footer: { js: "//# sourceURL=VCDArRpcWorker" }
}),
createContext({
...NodeCommonOpts,
entryPoints: ["src/preload/index.ts"],
outfile: "dist/js/preload.js",
footer: { js: "//# sourceURL=VCDPreload" }
}),
createContext({
...NodeCommonOpts,
entryPoints: ["src/preload/splash.ts"],
outfile: "dist/js/splashPreload.js"
}),
createContext({
...CommonOpts,
globalName: "Vesktop",
@@ -73,7 +85,7 @@ await Promise.all([
jsxFactory: "VencordCreateElement",
jsxFragment: "VencordFragment",
external: ["@vencord/types/*"],
plugins: [vencordDep],
plugins: [vencordDep, includeDirPlugin("patches", "src/renderer/patches")],
footer: { js: "//# sourceURL=VCDRenderer" }
})
]);

View File

@@ -0,0 +1,25 @@
import { Plugin } from "esbuild";
import { readdir } from "fs/promises";
const makeImportAllCode = (files: string[]) =>
files.map(f => `require("./${f.replace(/\.[cm]?[tj]sx?$/, "")}")`).join("\n");
const makeImportDirRecursiveCode = (dir: string) => readdir(dir).then(files => makeImportAllCode(files));
export function includeDirPlugin(namespace: string, path: string): Plugin {
return {
name: `include-dir-plugin:${namespace}`,
setup(build) {
const filter = new RegExp(`^__${namespace}__$`);
build.onResolve({ filter }, args => ({ path: args.path, namespace }));
build.onLoad({ filter, namespace }, async args => {
return {
contents: await makeImportDirRecursiveCode(path),
resolveDir: path
};
});
}
};
}

View File

@@ -4,25 +4,33 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { BrowserWindow } from "electron";
import { app, BrowserWindow } from "electron";
import { join } from "path";
import { ICON_PATH, VIEW_DIR } from "shared/paths";
import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally";
export function createAboutWindow() {
export async function createAboutWindow() {
const height = 750;
const width = height * (4 / 3);
const about = new BrowserWindow({
center: true,
autoHideMenuBar: true,
icon: ICON_PATH,
webPreferences: {
preload: join(__dirname, "updaterPreload.js")
}
height,
width
});
makeLinksOpenExternally(about);
about.loadFile(join(VIEW_DIR, "about.html"));
const data = new URLSearchParams({
APP_VERSION: app.getVersion()
});
about.loadFile(join(VIEW_DIR, "about.html"), {
search: data.toString()
});
return about;
}

View File

@@ -1,37 +0,0 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import Server from "arrpc";
import { IpcCommands } from "shared/IpcEvents";
import { sendRendererCommand } from "./ipcCommands";
import { Settings } from "./settings";
let server: any;
const inviteCodeRegex = /^(\w|-)+$/;
export async function initArRPC() {
if (server || !Settings.store.arRPC) return;
try {
server = await new Server();
server.on("activity", (data: any) => sendRendererCommand(IpcCommands.RPC_ACTIVITY, JSON.stringify(data)));
server.on("invite", async (invite: string, callback: (valid: boolean) => void) => {
invite = String(invite);
if (!inviteCodeRegex.test(invite)) return callback(false);
await sendRendererCommand(IpcCommands.RPC_INVITE, invite).then(callback);
});
server.on("link", async (data: any, deepCallback: (valid: boolean) => void) => {
await sendRendererCommand(IpcCommands.RPC_DEEP_LINK, data).then(deepCallback);
});
} catch (e) {
console.error("Failed to start arRPC server", e);
}
}
Settings.addChangeListener("arRPC", initArRPC);

77
src/main/arrpc/index.ts Normal file
View File

@@ -0,0 +1,77 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { resolve } from "path";
import { IpcCommands } from "shared/IpcEvents";
import { MessageChannel, Worker } from "worker_threads";
import { sendRendererCommand } from "../ipcCommands";
import { Settings } from "../settings";
import { ArRpcEvent, ArRpcHostEvent } from "./types";
let worker: Worker;
const inviteCodeRegex = /^(\w|-)+$/;
export async function initArRPC() {
if (worker || !Settings.store.arRPC) return;
try {
const { port1: hostPort, port2: workerPort } = new MessageChannel();
worker = new Worker(resolve(__dirname, "./arRpcWorker.js"), {
workerData: {
workerPort
},
transferList: [workerPort]
});
hostPort.on("message", async ({ type, nonce, data }: ArRpcEvent) => {
switch (type) {
case "activity": {
sendRendererCommand(IpcCommands.RPC_ACTIVITY, data);
break;
}
case "invite": {
const invite = String(data);
const response: ArRpcHostEvent = {
type: "ack-invite",
nonce,
data: false
};
if (!inviteCodeRegex.test(invite)) {
return hostPort.postMessage(response);
}
response.data = await sendRendererCommand(IpcCommands.RPC_INVITE, invite).catch(() => false);
hostPort.postMessage(response);
break;
}
case "link": {
const response: ArRpcHostEvent = {
type: "ack-link",
nonce: nonce,
data: false
};
response.data = await sendRendererCommand(IpcCommands.RPC_DEEP_LINK, data).catch(() => false);
hostPort.postMessage(response);
break;
}
}
});
} catch (e) {
console.error("Failed to start arRPC server", e);
}
}
Settings.addChangeListener("arRPC", initArRPC);

38
src/main/arrpc/types.ts Normal file
View File

@@ -0,0 +1,38 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2025 Vendicated and Vesktop contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
export type ArRpcEvent = ArRpcActivityEvent | ArRpcInviteEvent | ArRpcLinkEvent;
export type ArRpcHostEvent = ArRpcHostAckInviteEvent | ArRpcHostAckLinkEvent;
export interface ArRpcActivityEvent {
type: "activity";
nonce: string;
data: string;
}
export interface ArRpcInviteEvent {
type: "invite";
nonce: string;
data: string;
}
export interface ArRpcLinkEvent {
type: "link";
nonce: string;
data: any;
}
export interface ArRpcHostAckInviteEvent {
type: "ack-invite";
nonce: string;
data: boolean;
}
export interface ArRpcHostAckLinkEvent {
type: "ack-link";
nonce: string;
data: boolean;
}

73
src/main/arrpc/worker.ts Normal file
View File

@@ -0,0 +1,73 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2025 Vendicated and Vesktop contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import Server from "arrpc";
import { randomUUID } from "crypto";
import { MessagePort, workerData } from "worker_threads";
import { ArRpcEvent, ArRpcHostEvent } from "./types";
let server: any;
type InviteCallback = (valid: boolean) => void;
type LinkCallback = InviteCallback;
const inviteCallbacks = new Map<string, InviteCallback>();
const linkCallbacks = new Map<string, LinkCallback>();
(async function () {
const { workerPort } = workerData as { workerPort: MessagePort };
server = await new Server();
server.on("activity", (data: any) => {
const event: ArRpcEvent = {
type: "activity",
data: JSON.stringify(data),
nonce: randomUUID()
};
workerPort.postMessage(event);
});
server.on("invite", (invite: string, callback: InviteCallback) => {
const nonce = randomUUID();
inviteCallbacks.set(nonce, callback);
const event: ArRpcEvent = {
type: "invite",
data: invite,
nonce
};
workerPort.postMessage(event);
});
server.on("link", async (data: any, callback: LinkCallback) => {
const nonce = randomUUID();
linkCallbacks.set(nonce, callback);
const event: ArRpcEvent = {
type: "link",
data,
nonce
};
workerPort.postMessage(event);
});
workerPort.on("message", (e: ArRpcHostEvent) => {
switch (e.type) {
case "ack-invite": {
inviteCallbacks.get(e.nonce)?.(e.data);
inviteCallbacks.delete(e.nonce);
break;
}
case "ack-link": {
linkCallbacks.get(e.nonce)?.(e.data);
linkCallbacks.delete(e.nonce);
break;
}
}
});
})();

View File

@@ -7,6 +7,7 @@
import { app } from "electron";
import { existsSync, mkdirSync, renameSync, rmSync, writeFileSync } from "fs";
import { join } from "path";
import { stripIndent } from "shared/utils/text";
interface AutoStart {
isEnabled(): boolean;
@@ -31,15 +32,15 @@ function makeAutoStartLinux(): AutoStart {
return {
isEnabled: () => existsSync(file),
enable() {
const desktopFile = `
[Desktop Entry]
Type=Application
Name=Vesktop
Comment=Vesktop autostart script
Exec=${commandLine}
StartupNotify=false
Terminal=false
`.trim();
const desktopFile = stripIndent`
[Desktop Entry]
Type=Application
Name=Vesktop
Comment=Vesktop autostart script
Exec=${commandLine}
StartupNotify=false
Terminal=false
`;
mkdirSync(dir, { recursive: true });
writeFileSync(file, desktopFile);

View File

@@ -5,7 +5,7 @@
*/
import { app } from "electron";
import { existsSync, mkdirSync, readdirSync, renameSync, rmdirSync } from "fs";
import { existsSync, mkdirSync } from "fs";
import { dirname, join } from "path";
const vesktopDir = dirname(process.execPath);
@@ -15,28 +15,11 @@ export const PORTABLE =
!process.execPath.toLowerCase().endsWith("electron.exe") &&
!existsSync(join(vesktopDir, "Uninstall Vesktop.exe"));
const LEGACY_DATA_DIR = join(app.getPath("appData"), "VencordDesktop", "VencordDesktop");
export const DATA_DIR =
process.env.VENCORD_USER_DATA_DIR || (PORTABLE ? join(vesktopDir, "Data") : join(app.getPath("userData")));
mkdirSync(DATA_DIR, { recursive: true });
// TODO: remove eventually
if (existsSync(LEGACY_DATA_DIR)) {
try {
console.warn("Detected legacy settings dir", LEGACY_DATA_DIR + ".", "migrating to", DATA_DIR);
for (const file of readdirSync(LEGACY_DATA_DIR)) {
renameSync(join(LEGACY_DATA_DIR, file), join(DATA_DIR, file));
}
rmdirSync(LEGACY_DATA_DIR);
renameSync(
join(app.getPath("appData"), "VencordDesktop", "IndexedDB"),
join(DATA_DIR, "sessionData", "IndexedDB")
);
} catch (e) {
console.error("Migration failed", e);
}
}
const SESSION_DATA_DIR = join(DATA_DIR, "sessionData");
app.setPath("sessionData", SESSION_DATA_DIR);

View File

@@ -17,9 +17,7 @@ import { registerScreenShareHandler } from "./screenShare";
import { Settings, State } from "./settings";
import { isDeckGameMode } from "./utils/steamOS";
if (IS_DEV) {
require("source-map-support").install();
} else {
if (!IS_DEV) {
autoUpdater.checkForUpdatesAndNotify();
}
@@ -28,23 +26,33 @@ console.log("Vesktop v" + app.getVersion());
// Make the Vencord files use our DATA_DIR
process.env.VENCORD_USER_DATA_DIR = DATA_DIR;
const isLinux = process.platform === "linux";
export let enableHardwareAcceleration = true;
function init() {
app.setAsDefaultProtocolClient("discord");
const { disableSmoothScroll, hardwareAcceleration } = Settings.store;
const { disableSmoothScroll, hardwareAcceleration, hardwareVideoAcceleration } = Settings.store;
const enabledFeatures = app.commandLine.getSwitchValue("enable-features").split(",");
const disabledFeatures = app.commandLine.getSwitchValue("disable-features").split(",");
const enabledFeatures = new Set(app.commandLine.getSwitchValue("enable-features").split(","));
const disabledFeatures = new Set(app.commandLine.getSwitchValue("disable-features").split(","));
app.commandLine.removeSwitch("enable-features");
app.commandLine.removeSwitch("disable-features");
if (hardwareAcceleration === false) {
if (hardwareAcceleration === false || process.argv.includes("--disable-gpu")) {
enableHardwareAcceleration = false;
app.disableHardwareAcceleration();
} else {
enabledFeatures.push(
"AcceleratedVideoDecodeLinuxGL",
"AcceleratedVideoEncoder",
"AcceleratedVideoDecoder",
"AcceleratedVideoDecodeLinuxZeroCopyGL"
);
if (hardwareVideoAcceleration) {
enabledFeatures.add("AcceleratedVideoEncoder");
enabledFeatures.add("AcceleratedVideoDecoder");
if (isLinux) {
enabledFeatures.add("AcceleratedVideoDecodeLinuxGL");
enabledFeatures.add("AcceleratedVideoDecodeLinuxZeroCopyGL");
}
}
}
if (disableSmoothScroll) {
@@ -58,22 +66,37 @@ function init() {
app.commandLine.appendSwitch("disable-background-timer-throttling");
app.commandLine.appendSwitch("disable-backgrounding-occluded-windows");
if (process.platform === "win32") {
disabledFeatures.push("CalculateNativeWinOcclusion");
disabledFeatures.add("CalculateNativeWinOcclusion");
}
// work around chrome 66 disabling autoplay by default
app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required");
// WinRetrieveSuggestionsOnlyOnDemand: Work around electron 13 bug w/ async spellchecking on Windows.
// HardwareMediaKeyHandling,MediaSessionService: Prevent Discord from registering as a media service.
//
// WidgetLayering (Vencord Added): Fix DevTools context menus https://github.com/electron/electron/issues/38790
disabledFeatures.push("WinRetrieveSuggestionsOnlyOnDemand", "HardwareMediaKeyHandling", "MediaSessionService");
// HardwareMediaKeyHandling, MediaSessionService: Prevent Discord from registering as a media service.
disabledFeatures.add("WinRetrieveSuggestionsOnlyOnDemand");
disabledFeatures.add("HardwareMediaKeyHandling");
disabledFeatures.add("MediaSessionService");
// Support TTS on Linux using speech-dispatcher
app.commandLine.appendSwitch("enable-speech-dispatcher");
if (isLinux) {
// Support TTS on Linux using https://wiki.archlinux.org/title/Speech_dispatcher
app.commandLine.appendSwitch("enable-speech-dispatcher");
}
app.commandLine.appendSwitch("enable-features", [...new Set(enabledFeatures)].filter(Boolean).join(","));
app.commandLine.appendSwitch("disable-features", [...new Set(disabledFeatures)].filter(Boolean).join(","));
disabledFeatures.forEach(feat => enabledFeatures.delete(feat));
const enabledFeaturesArray = enabledFeatures.values().filter(Boolean).toArray();
const disabledFeaturesArray = disabledFeatures.values().filter(Boolean).toArray();
if (enabledFeaturesArray.length) {
app.commandLine.appendSwitch("enable-features", enabledFeaturesArray.join(","));
console.log("Enabled Chromium features:", enabledFeaturesArray.join(", "));
}
if (disabledFeaturesArray.length) {
app.commandLine.appendSwitch("disable-features", disabledFeaturesArray.join(","));
console.log("Disabled Chromium features:", disabledFeaturesArray.join(", "));
}
// In the Flatpak on SteamOS the theme is detected as light, but SteamOS only has a dark mode, so we just override it
if (isDeckGameMode) nativeTheme.themeSource = "dark";

View File

@@ -20,6 +20,7 @@ import {
} from "electron";
import { mkdirSync, readFileSync, watch } from "fs";
import { open, readFile } from "fs/promises";
import { enableHardwareAcceleration } from "main";
import { release } from "os";
import { join } from "path";
import { debounce } from "shared/utils/debounce";
@@ -45,6 +46,7 @@ handleSync(IpcEvents.GET_RENDERER_CSS_FILE, () => join(__dirname, "renderer.css"
handleSync(IpcEvents.GET_SETTINGS, () => Settings.plain);
handleSync(IpcEvents.GET_VERSION, () => app.getVersion());
handleSync(IpcEvents.GET_ENABLE_HARDWARE_ACCELERATION, () => enableHardwareAcceleration);
handleSync(
IpcEvents.SUPPORTS_WINDOWS_TRANSPARENCY,

View File

@@ -31,6 +31,11 @@ export interface IpcResponse {
* You must add a handler for the message in the renderer process.
*/
export function sendRendererCommand<T = any>(message: string, data?: any) {
if (mainWin.isDestroyed()) {
console.warn("Main window is destroyed, cannot send IPC command:", message);
return Promise.reject(new Error("Main window is destroyed"));
}
const nonce = randomUUID();
const promise = new Promise<T>((resolve, reject) => {

View File

@@ -16,6 +16,7 @@ import {
session,
Tray
} from "electron";
import { EventEmitter } from "events";
import { rm } from "fs/promises";
import { join } from "path";
import { IpcCommands, IpcEvents } from "shared/IpcEvents";
@@ -39,7 +40,7 @@ import {
import { darwinURL } from "./index";
import { sendRendererCommand } from "./ipcCommands";
import { Settings, State, VencordSettings } from "./settings";
import { createSplashWindow } from "./splash";
import { createSplashWindow, updateSplashMessage } from "./splash";
import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally";
import { applyDeckKeyboardFix, askToApplySteamLayout, isDeckGameMode } from "./utils/steamOS";
import { downloadVencordFiles, ensureVencordFiles } from "./utils/vencordLoader";
@@ -245,7 +246,7 @@ function initMenuBar(win: BrowserWindow) {
}
] satisfies MenuItemList;
const menu = Menu.buildFromTemplate([
const menuItems = [
{
label: "Vesktop",
role: "appMenu",
@@ -253,8 +254,11 @@ function initMenuBar(win: BrowserWindow) {
},
{ role: "fileMenu" },
{ role: "editMenu" },
{ role: "viewMenu" }
]);
{ role: "viewMenu" },
isDarwin && { role: "windowMenu" }
] satisfies MenuItemList;
const menu = Menu.buildFromTemplate(menuItems.filter(isTruthy));
Menu.setApplicationMenu(menu);
}
@@ -384,6 +388,15 @@ function initSpellCheck(win: BrowserWindow) {
initSpellCheckLanguages(win, Settings.store.spellCheckLanguages);
}
function initDevtoolsListeners(win: BrowserWindow) {
win.webContents.on("devtools-opened", () => {
win.webContents.send(IpcEvents.DEVTOOLS_OPENED);
});
win.webContents.on("devtools-closed", () => {
win.webContents.send(IpcEvents.DEVTOOLS_CLOSED);
});
}
function initStaticTitle(win: BrowserWindow) {
const listener = (e: { preventDefault: Function }) => e.preventDefault();
@@ -469,22 +482,39 @@ function createMainWindow() {
makeLinksOpenExternally(win);
initSettingsListeners(win);
initSpellCheck(win);
initDevtoolsListeners(win);
initStaticTitle(win);
win.webContents.setUserAgent(BrowserUserAgent);
// if the open-url event is fired (in index.ts) while starting up, darwinURL will be set. If not fall back to checking the process args (which Windows and Linux use for URI calling.)
// win.webContents.session.clearCache().then(() => {
loadUrl(darwinURL || process.argv.find(arg => arg.startsWith("discord://")));
// });
return win;
}
const runVencordMain = once(() => require(join(VENCORD_FILES_DIR, "vencordDesktopMain.js")));
const loadEvents = new EventEmitter();
export function loadUrl(uri: string | undefined) {
const branch = Settings.store.discordBranch;
const subdomain = branch === "canary" || branch === "ptb" ? `${branch}.` : "";
mainWin.loadURL(`https://${subdomain}discord.com/${uri ? new URL(uri).pathname.slice(1) || "app" : "app"}`);
// we do not rely on 'did-finish-load' because it fires even if loadURL fails which triggers early detruction of the splash
mainWin
.loadURL(`https://${subdomain}discord.com/${uri ? new URL(uri).pathname.slice(1) || "app" : "app"}`)
.then(() => loadEvents.emit("app-loaded"))
.catch(error => retryUrl(error.url, error.code));
}
const retryDelay = 1000;
function retryUrl(url: string, description: string) {
console.log(`retrying in ${retryDelay}ms`);
updateSplashMessage(`Failed to load Discord: ${description}`);
setTimeout(() => loadUrl(url), retryDelay);
}
export async function createWindows() {
@@ -503,7 +533,7 @@ export async function createWindows() {
mainWin = createMainWindow();
mainWin.webContents.on("did-finish-load", () => {
loadEvents.on("app-loaded", () => {
splash?.destroy();
if (!startMinimized) {
@@ -526,6 +556,8 @@ export async function createWindows() {
});
mainWin.webContents.on("did-navigate", (_, url: string, responseCode: number) => {
updateSplashMessage(""); // clear the splash message
// check url to ensure app doesn't loop
if (responseCode >= 300 && new URL(url).pathname !== `/app`) {
loadUrl(undefined);

View File

@@ -6,8 +6,9 @@
import { desktopCapturer, session, Streams } from "electron";
import type { StreamPick } from "renderer/components/ScreenSharePicker";
import { IpcEvents } from "shared/IpcEvents";
import { IpcCommands, IpcEvents } from "shared/IpcEvents";
import { sendRendererCommand } from "./ipcCommands";
import { handle } from "./utils/ipcWrappers";
const isWayland =
@@ -49,11 +50,11 @@ export function registerScreenShareHandler() {
if (isWayland) {
const video = data[0];
if (video) {
const stream = await request
.frame!.executeJavaScript(
`Vesktop.Components.ScreenShare.openScreenSharePicker(${JSON.stringify([video])},true)`
)
.catch(() => null);
const stream = await sendRendererCommand<StreamPick>(IpcCommands.SCREEN_SHARE_PICKER, {
screens: [video],
skipPicker: true
}).catch(() => null);
if (stream === null) return callback({});
}
@@ -61,13 +62,13 @@ export function registerScreenShareHandler() {
return;
}
const choice = await request
.frame!.executeJavaScript(`Vesktop.Components.ScreenShare.openScreenSharePicker(${JSON.stringify(data)})`)
.then(e => e as StreamPick)
.catch(e => {
console.error("Error during screenshare picker", e);
return null;
});
const choice = await sendRendererCommand<StreamPick>(IpcCommands.SCREEN_SHARE_PICKER, {
screens: data,
skipPicker: false
}).catch(e => {
console.error("Error during screenshare picker", e);
return null;
});
if (!choice) return callback({});
@@ -77,7 +78,7 @@ export function registerScreenShareHandler() {
const streams: Streams = {
video: source
};
if (choice.audio && process.platform === "win32") streams.audio = "loopbackWithMute";
if (choice.audio && process.platform === "win32") streams.audio = "loopback";
callback(streams);
});

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
import { mkdirSync, readFileSync, writeFileSync } from "fs";
import { dirname, join } from "path";
import type { Settings as TSettings, State as TState } from "shared/settings";
import { SettingsStore } from "shared/utils/SettingsStore";
@@ -35,18 +35,5 @@ function loadSettings<T extends object = any>(file: string, name: string) {
}
export const Settings = loadSettings<TSettings>(SETTINGS_FILE, "Vesktop settings");
export const VencordSettings = loadSettings<any>(VENCORD_SETTINGS_FILE, "Vencord settings");
if (Object.hasOwn(Settings.plain, "firstLaunch") && !existsSync(STATE_FILE)) {
console.warn("legacy state in settings.json detected. migrating to state.json");
const state = {} as TState;
for (const prop of ["firstLaunch", "maximized", "minimized", "steamOSLayoutVersion", "windowBounds"] as const) {
state[prop] = Settings.plain[prop];
delete Settings.plain[prop];
}
Settings.markAsChanged();
writeFileSync(STATE_FILE, JSON.stringify(state, null, 4));
}
export const State = loadSettings<TState>(STATE_FILE, "Vesktop state");

View File

@@ -11,11 +11,16 @@ import { ICON_PATH, VIEW_DIR } from "shared/paths";
import { Settings } from "./settings";
let splash: BrowserWindow | undefined;
export function createSplashWindow(startMinimized = false) {
const splash = new BrowserWindow({
splash = new BrowserWindow({
...SplashProps,
icon: ICON_PATH,
show: !startMinimized
show: !startMinimized,
webPreferences: {
preload: join(__dirname, "splashPreload.js")
}
});
splash.loadFile(join(VIEW_DIR, "splash.html"));
@@ -37,3 +42,7 @@ export function createSplashWindow(startMinimized = false) {
return splash;
}
export function updateSplashMessage(message: string) {
if (splash && !splash.isDestroyed()) splash.webContents.send("update-splash-message", message);
}

View File

@@ -8,25 +8,33 @@ import { ipcMain, IpcMainEvent, IpcMainInvokeEvent, WebFrameMain } from "electro
import { DISCORD_HOSTNAMES } from "main/constants";
import { IpcEvents } from "shared/IpcEvents";
export function validateSender(frame: WebFrameMain | null) {
if (!frame) throw new Error("ipc: No sender frame");
export function validateSender(frame: WebFrameMain | null, event: string) {
if (!frame) throw new Error(`ipc[${event}]: No sender frame`);
if (!frame.url) return;
try {
var { hostname, protocol } = new URL(frame.url);
} catch (e) {
throw new Error(`ipc[${event}]: Invalid URL ${frame.url}`);
}
const { hostname, protocol } = new URL(frame.url);
if (protocol === "file:") return;
if (!DISCORD_HOSTNAMES.includes(hostname)) throw new Error("ipc: Disallowed host " + hostname);
if (!DISCORD_HOSTNAMES.includes(hostname)) {
throw new Error(`ipc[${event}]: Disallowed hostname ${hostname}`);
}
}
export function handleSync(event: IpcEvents, cb: (e: IpcMainEvent, ...args: any[]) => any) {
ipcMain.on(event, (e, ...args) => {
validateSender(e.senderFrame);
validateSender(e.senderFrame, event);
e.returnValue = cb(e, ...args);
});
}
export function handle(event: IpcEvents, cb: (e: IpcMainInvokeEvent, ...args: any[]) => any) {
ipcMain.handle(event, (e, ...args) => {
validateSender(e.senderFrame);
validateSender(e.senderFrame, event);
return cb(e, ...args);
});
}

View File

@@ -50,7 +50,7 @@ export function handleExternalUrl(url: string, protocol?: string): { action: "de
export function makeLinksOpenExternally(win: BrowserWindow) {
win.webContents.setWindowOpenHandler(({ url, frameName, features }) => {
try {
var { protocol, hostname, pathname } = new URL(url);
var { protocol, hostname, pathname, searchParams } = new URL(url);
} catch {
return { action: "deny" };
}
@@ -59,8 +59,10 @@ export function makeLinksOpenExternally(win: BrowserWindow) {
return createOrFocusPopup(frameName, features);
}
if (url === "about:blank" || (frameName === "authorize" && DISCORD_HOSTNAMES.includes(hostname)))
return { action: "allow" };
if (url === "about:blank") return { action: "allow" };
// Drop the static temp page Discord web loads for the connections popout
if (frameName === "authorize" && searchParams.get("loading") === "true") return { action: "deny" };
return handleExternalUrl(url, protocol);
});

10
src/module.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2025 Vendicated and Vesktop contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
declare module "__patches__" {
const never: never;
export default never;
}

View File

@@ -20,12 +20,19 @@ ipcRenderer.on(IpcEvents.SPELLCHECK_RESULT, (_, w: string, s: string[]) => {
spellCheckCallbacks.forEach(cb => cb(w, s));
});
let onDevtoolsOpen = () => {};
let onDevtoolsClose = () => {};
ipcRenderer.on(IpcEvents.DEVTOOLS_OPENED, () => onDevtoolsOpen());
ipcRenderer.on(IpcEvents.DEVTOOLS_CLOSED, () => onDevtoolsClose());
export const VesktopNative = {
app: {
relaunch: () => invoke<void>(IpcEvents.RELAUNCH),
getVersion: () => sendSync<void>(IpcEvents.GET_VERSION),
setBadgeCount: (count: number) => invoke<void>(IpcEvents.SET_BADGE_COUNT, count),
supportsWindowsTransparency: () => sendSync<boolean>(IpcEvents.SUPPORTS_WINDOWS_TRANSPARENCY)
supportsWindowsTransparency: () => sendSync<boolean>(IpcEvents.SUPPORTS_WINDOWS_TRANSPARENCY),
getEnableHardwareAcceleration: () => sendSync<boolean>(IpcEvents.GET_ENABLE_HARDWARE_ACCELERATION)
},
autostart: {
isEnabled: () => sendSync<boolean>(IpcEvents.AUTOSTART_ENABLED),
@@ -56,7 +63,11 @@ export const VesktopNative = {
focus: () => invoke<void>(IpcEvents.FOCUS),
close: (key?: string) => invoke<void>(IpcEvents.CLOSE, key),
minimize: (key?: string) => invoke<void>(IpcEvents.MINIMIZE, key),
maximize: (key?: string) => invoke<void>(IpcEvents.MAXIMIZE, key)
maximize: (key?: string) => invoke<void>(IpcEvents.MAXIMIZE, key),
setDevtoolsCallbacks: (onOpen: () => void, onClose: () => void) => {
onDevtoolsOpen = onOpen;
onDevtoolsClose = onClose;
}
},
capturer: {
getLargeThumbnail: (id: string) => invoke<string>(IpcEvents.CAPTURER_GET_LARGE_THUMBNAIL, id)

13
src/preload/splash.ts Normal file
View File

@@ -0,0 +1,13 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2025 Vendicated and Vesktop contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { contextBridge, ipcRenderer } from "electron";
contextBridge.exposeInMainWorld("VesktopSplashNative", {
onUpdateMessage(callback: (message: string) => void) {
ipcRenderer.on("update-splash-message", (_, message: string) => callback(message));
}
});

9
src/renderer/common.ts Normal file
View File

@@ -0,0 +1,9 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2025 Vendicated and Vesktop contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { findStoreLazy } from "@vencord/types/webpack";
export const MediaEngineStore = findStoreLazy("MediaEngineStore");

View File

@@ -7,7 +7,7 @@
import "./screenSharePicker.css";
import { closeModal, Logger, Modals, ModalSize, openModal, useAwaiter } from "@vencord/types/utils";
import { findStoreLazy, onceReady } from "@vencord/types/webpack";
import { onceReady } from "@vencord/types/webpack";
import {
Button,
Card,
@@ -21,6 +21,7 @@ import {
} from "@vencord/types/webpack/common";
import { Node } from "@vencord/venmic";
import type { Dispatch, SetStateAction } from "react";
import { MediaEngineStore } from "renderer/common";
import { addPatch } from "renderer/patches/shared";
import { State, useSettings, useVesktopState } from "renderer/settings";
import { classNameFactory, isLinux, isWindows } from "renderer/utils";
@@ -30,8 +31,6 @@ const StreamFps = ["15", "30", "60"] as const;
const cl = classNameFactory("vcd-screen-picker-");
const MediaEngineStore = findStoreLazy("MediaEngineStore");
export type StreamResolution = (typeof StreamResolutions)[number];
export type StreamFps = (typeof StreamFps)[number];

View File

@@ -4,15 +4,16 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { Switch, useState } from "@vencord/types/webpack/common";
import { useState } from "@vencord/types/webpack/common";
import { SettingsComponent } from "./Settings";
import { VesktopSettingsSwitch } from "./VesktopSettingsSwitch";
export const AutoStartToggle: SettingsComponent = () => {
const [autoStartEnabled, setAutoStartEnabled] = useState(VesktopNative.autostart.isEnabled());
return (
<Switch
<VesktopSettingsSwitch
value={autoStartEnabled}
onChange={async v => {
await VesktopNative.autostart[v ? "enable" : "disable"]();
@@ -21,6 +22,6 @@ export const AutoStartToggle: SettingsComponent = () => {
note="Automatically start Vesktop on computer start-up"
>
Start With System
</Switch>
</VesktopSettingsSwitch>
);
};

View File

@@ -4,14 +4,14 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { Switch } from "@vencord/types/webpack/common";
import { setBadge } from "renderer/appBadge";
import { SettingsComponent } from "./Settings";
import { VesktopSettingsSwitch } from "./VesktopSettingsSwitch";
export const NotificationBadgeToggle: SettingsComponent = ({ settings }) => {
return (
<Switch
<VesktopSettingsSwitch
value={settings.appBadge ?? true}
onChange={v => {
settings.appBadge = v;
@@ -21,6 +21,6 @@ export const NotificationBadgeToggle: SettingsComponent = ({ settings }) => {
note="Show mention badge on the app icon"
>
Notification Badge
</Switch>
</VesktopSettingsSwitch>
);
};

View File

@@ -7,7 +7,7 @@
import "./settings.css";
import { ErrorBoundary } from "@vencord/types/components";
import { Forms, Switch, Text } from "@vencord/types/webpack/common";
import { Forms, Text } from "@vencord/types/webpack/common";
import { ComponentType } from "react";
import { Settings, useSettings } from "renderer/settings";
import { isMac, isWindows } from "renderer/utils";
@@ -16,6 +16,7 @@ import { AutoStartToggle } from "./AutoStartToggle";
import { DeveloperOptionsButton } from "./DeveloperOptions";
import { DiscordBranchPicker } from "./DiscordBranchPicker";
import { NotificationBadgeToggle } from "./NotificationBadgeToggle";
import { VesktopSettingsSwitch } from "./VesktopSettingsSwitch";
import { WindowsTransparencyControls } from "./WindowsTransparencyControls";
interface BooleanSetting {
@@ -38,6 +39,14 @@ const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>>
title: "Hardware Acceleration",
description: "Enable hardware acceleration",
defaultValue: true
},
{
key: "hardwareVideoAcceleration",
title: "Video Hardware Acceleration",
description:
"Enable hardware video acceleration. This can improve performance of screenshare and video playback, but may cause graphical glitches and infinitely loading streams.",
defaultValue: false,
disabled: () => Settings.store.hardwareAcceleration === false
}
],
"User Interface": [
@@ -132,32 +141,35 @@ const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>>
function SettingsSections() {
const Settings = useSettings();
const sections = Object.entries(SettingsOptions).map(([title, settings]) => (
<Forms.FormSection
title={title}
key={title}
className="vcd-settings-section"
titleClassName="vcd-settings-title"
>
{settings.map(Setting => {
if (typeof Setting === "function") return <Setting settings={Settings} />;
const sections = Object.entries(SettingsOptions).map(([title, settings], i, arr) => (
<div key={title} className="vcd-settings-category">
<Text variant="heading-lg/semibold" color="header-primary" className="vcd-settings-category-title">
{title}
</Text>
const { defaultValue, title, description, key, disabled, invisible } = Setting;
if (invisible?.()) return null;
<div className="vcd-settings-category-content">
{settings.map(Setting => {
if (typeof Setting === "function") return <Setting settings={Settings} />;
return (
<Switch
value={Settings[key as any] ?? defaultValue}
onChange={v => (Settings[key as any] = v)}
note={description}
disabled={disabled?.()}
key={key}
>
{title}
</Switch>
);
})}
</Forms.FormSection>
const { defaultValue, title, description, key, disabled, invisible } = Setting;
if (invisible?.()) return null;
return (
<VesktopSettingsSwitch
value={Settings[key as any] ?? defaultValue}
onChange={v => (Settings[key as any] = v)}
note={description}
disabled={disabled?.()}
key={key}
>
{title}
</VesktopSettingsSwitch>
);
})}
</div>
{i < arr.length - 1 && <Forms.FormDivider className="vcd-settings-category-divider" />}
</div>
));
return <>{sections}</>;
@@ -167,10 +179,11 @@ export default ErrorBoundary.wrap(
function SettingsUI() {
return (
<Forms.FormSection>
<Text variant="heading-lg/semibold" style={{ color: "var(--header-primary)" }} tag="h2">
{/* FIXME: Outdated type */}
{/* @ts-expect-error Outdated type */}
<Text variant="heading-xl/semibold" color="header-primary" className="vcd-settings-title">
Vesktop Settings
</Text>
<SettingsSections />
</Forms.FormSection>
);

View File

@@ -0,0 +1,16 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2025 Vendicated and Vesktop contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { Switch } from "@vencord/types/webpack/common";
import { ComponentProps } from "react";
export function VesktopSettingsSwitch(props: ComponentProps<typeof Switch>) {
return (
<Switch {...props} hideBorder className="vcd-settings-switch">
{props.children}
</Switch>
);
}

View File

@@ -13,8 +13,8 @@ export const WindowsTransparencyControls: SettingsComponent = ({ settings }) =>
if (!VesktopNative.app.supportsWindowsTransparency()) return null;
return (
<>
<Forms.FormTitle className={Margins.top16 + " " + Margins.bottom8}>Transparency Options</Forms.FormTitle>
<div>
<Forms.FormTitle className={Margins.bottom8}>Transparency Options</Forms.FormTitle>
<Forms.FormText className={Margins.bottom8}>
Requires a full restart. You will need a theme that supports transparency for this to work.
</Forms.FormText>
@@ -42,8 +42,6 @@ export const WindowsTransparencyControls: SettingsComponent = ({ settings }) =>
isSelected={v => v === settings.transparencyOption}
serialize={s => s}
/>
<Forms.FormDivider className={Margins.top16 + " " + Margins.bottom16} />
</>
</div>
);
};

View File

@@ -5,10 +5,30 @@
margin-top: 0.5em;
}
.vcd-settings-section {
margin-top: 1.5rem;
.vcd-settings-title {
margin-bottom: 32px;
}
.vcd-settings-title {
margin-bottom: 0.5rem;
.vcd-settings-category {
display: flex;
flex-direction: column;
}
.vcd-settings-category-title {
margin-bottom: 16px;
}
.vcd-settings-category-content {
display: flex;
flex-direction: column;
gap: 24px;
}
.vcd-settings-category-divider {
margin-top: 32px;
margin-bottom: 32px;
}
.vcd-settings-switch {
margin-bottom: 0;
}

View File

@@ -1,4 +0,0 @@
/* Workaround for making things in the draggable area clickable again on macOS */
.platform-osx [class*=topic_], .platform-osx [class*=notice_] button {
-webkit-app-region: no-drag;
}

View File

@@ -4,8 +4,6 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import "./fixes.css";
import { localStorage } from "./utils";
// Make clicking Notifications focus the window

View File

@@ -7,9 +7,9 @@
import "./themedSplash";
import "./ipcCommands";
import "./appBadge";
import "./patches";
import "./fixes";
import "./arrpc";
import "__patches__"; // auto generated by the build script
export * as Components from "./components";

View File

@@ -7,6 +7,8 @@
import { SettingsRouter } from "@vencord/types/webpack/common";
import { IpcCommands } from "shared/IpcEvents";
import { openScreenSharePicker } from "./components/ScreenSharePicker";
type IpcCommandHandler = (data: any) => any;
const handlers = new Map<string, IpcCommandHandler>();
@@ -46,4 +48,7 @@ export function offIpcCommand(channel: string) {
onIpcCommand(IpcCommands.NAVIGATE_SETTINGS, () => {
SettingsRouter.open("My Account");
});
onIpcCommand(IpcCommands.GET_LANGUAGES, () => navigator.languages);
onIpcCommand(IpcCommands.SCREEN_SHARE_PICKER, data => openScreenSharePicker(data.screens, data.skipPicker));

View File

@@ -1,19 +0,0 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2025 Vendicated and Vesktop contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { addPatch } from "./shared";
addPatch({
patches: [
{
find: '"mod+alt+i"',
replacement: {
match: /"discord\.com"===location\.host/,
replace: "false"
}
}
]
});

View File

@@ -0,0 +1,41 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2025 Vendicated and Vesktop contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { addPatch } from "./shared";
addPatch({
patches: [
// Discord Web blocks the devtools keybin on mac specifically, disable that
{
find: '"mod+alt+i"',
replacement: {
match: /"discord\.com"===location\.host/,
replace: "false"
}
},
// Discord Web uses an incredibly broken devtools detector with false positives.
// They "hide" (aka remove from storage) your token if it "detects" open devtools.
// Due to the false positives, this leads to random logouts.
// Patch their devtools detection to use proper Electron APIs instead to fix the false positives
{
find: ".setDevtoolsCallbacks(",
group: true,
replacement: [
{
// eslint-disable-next-line no-useless-escape
match: /if\(null!=(\i)\)(?=.{0,50}\1\.window\.setDevtoolsCallbacks)/,
replace: "if(true)"
},
{
// eslint-disable-next-line no-useless-escape
match: /\b\i\.window\.setDevtoolsCallbacks/g,
replace: "VesktopNative.win.setDevtoolsCallbacks"
}
]
}
]
});

View File

@@ -0,0 +1,51 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2025 Vendicated and Vesktop contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { Logger } from "@vencord/types/utils";
import { MediaEngineStore } from "renderer/common";
const logger = new Logger("FixAutoGain");
function fixTrackConstraints(constraint: MediaTrackConstraints) {
const target = constraint.advanced?.find(opt => Object.hasOwn(opt, "autoGainControl")) ?? constraint;
target.autoGainControl = MediaEngineStore.getAutomaticGainControl();
}
function fixStreamConstraints(constraints: MediaStreamConstraints | undefined) {
if (!constraints?.audio) return;
if (typeof constraints.audio !== "object") {
constraints.audio = {};
}
fixTrackConstraints(constraints.audio);
}
const originalGetUserMedia = navigator.mediaDevices.getUserMedia;
navigator.mediaDevices.getUserMedia = function (constraints) {
try {
fixStreamConstraints(constraints);
logger.debug("Fixed getUserMedia constraints", constraints);
} catch (e) {
logger.error("Failed to fix getUserMedia constraints", e);
}
return originalGetUserMedia.call(this, constraints);
};
const originalApplyConstraints = MediaStreamTrack.prototype.applyConstraints;
MediaStreamTrack.prototype.applyConstraints = function (constraints) {
if (constraints) {
try {
fixTrackConstraints(constraints);
logger.debug("Fixed applyConstraints constraints", constraints);
} catch (e) {
logger.error("Failed to fix applyConstraints constraints", e);
}
}
return originalApplyConstraints.call(this, constraints);
};

View File

@@ -13,12 +13,12 @@ addPatch({
replacement: {
// eslint-disable-next-line no-useless-escape
match: /(\i)\.\i\.getState\(\).neverShowModal/,
replace: "$& || $self.shouldIgnore($1)"
replace: "$& || $self.shouldIgnoreDevice($1)"
}
}
],
shouldIgnore(state: any) {
shouldIgnoreDevice(state: any) {
return Object.keys(state?.default?.lastDeviceConnected ?? {})?.[0] === "vencord-screen-share";
}
});

View File

@@ -1,18 +0,0 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
// TODO: Possibly auto generate glob if we have more patches in the future
import "./enableNotificationsByDefault";
import "./platformClass";
import "./allowDevToolsKeybind";
import "./hideSwitchDevice";
import "./hideVenmicInput";
import "./screenShareFixes";
import "./spellCheck";
import "./windowsTitleBar";
import "./streamerMode";
import "./windowMethods";
import "./hideDownloadAppsButton";

View File

@@ -59,10 +59,15 @@ if (isLinux) {
},
autoGainControl: false,
echoCancellation: false,
noiseSuppression: false
noiseSuppression: false,
channelCount: 2,
sampleRate: 48000,
sampleSize: 16
}
});
audio.getAudioTracks().forEach(t => stream.addTrack(t));
stream.getAudioTracks().forEach(t => stream.removeTrack(t));
stream.addTrack(audio.getAudioTracks()[0]);
}
return stream;

View File

@@ -17,7 +17,6 @@ export function addPatch<P extends PatchData>(p: P) {
const { patches, ...globals } = p;
for (const patch of patches) {
// TODO: Update types
Vencord.Plugins.addPatch(patch, "Vesktop", "VesktopPatchGlobals");
}

View File

@@ -56,7 +56,7 @@ addContextMenuPatch("textarea-context", children => {
const settings = useSettings();
const spellCheckLanguages = (settings.spellCheckLanguages ??= [...new Set(navigator.languages)]);
const pasteSectionIndex = children.findIndex(c => c?.props?.children?.some(c => c?.props?.id === "paste"));
const pasteSectionIndex = children.findIndex(c => c?.props?.children?.some?.(c => c?.props?.id === "paste"));
children.splice(
pasteSectionIndex === -1 ? children.length : pasteSectionIndex,

View File

@@ -21,6 +21,10 @@ addPatch({
// eslint-disable-next-line no-useless-escape
match: /(focus(\(\i\)){).{0,150}?\.focus\(\i,\i\)/,
replace: "$1VesktopNative.win.focus$2"
},
{
match: /,getEnableHardwareAcceleration/,
replace: "$&:VesktopNative.app.getEnableHardwareAcceleration,_oldGetEnableHardwareAcceleration"
}
]
}

View File

@@ -24,7 +24,7 @@ if (Settings.store.customTitleBar)
},
// Visual Refresh
{
find: '"data-windows":',
find: ".systemBar,",
replacement: [
{
// TODO: Fix eslint rule

View File

@@ -59,7 +59,7 @@ function resolveColor(color: string) {
const updateSplashColors = () => {
const bodyStyles = document.body.computedStyleMap();
const color = bodyStyles.get("--text-normal");
const color = bodyStyles.get("--text-default");
const backgroundColor = bodyStyles.get("--background-primary");
if (isValidColor(color)) {

View File

@@ -12,6 +12,7 @@ export const enum IpcEvents {
GET_VERSION = "VCD_GET_VERSION",
SUPPORTS_WINDOWS_TRANSPARENCY = "VCD_SUPPORTS_WINDOWS_TRANSPARENCY",
GET_ENABLE_HARDWARE_ACCELERATION = "VCD_GET_ENABLE_HARDWARE_ACCELERATION",
RELAUNCH = "VCD_RELAUNCH",
CLOSE = "VCD_CLOSE",
@@ -48,20 +49,25 @@ export const enum IpcEvents {
VIRT_MIC_START_SYSTEM = "VCD_VIRT_MIC_START_ALL",
VIRT_MIC_STOP = "VCD_VIRT_MIC_STOP",
ARRPC_ACTIVITY = "VCD_ARRPC_ACTIVITY",
CLIPBOARD_COPY_IMAGE = "VCD_CLIPBOARD_COPY_IMAGE",
DEBUG_LAUNCH_GPU = "VCD_DEBUG_LAUNCH_GPU",
DEBUG_LAUNCH_WEBRTC_INTERNALS = "VCD_DEBUG_LAUNCH_WEBRTC",
IPC_COMMAND = "VCD_IPC_COMMAND"
IPC_COMMAND = "VCD_IPC_COMMAND",
DEVTOOLS_OPENED = "VCD_DEVTOOLS_OPENED",
DEVTOOLS_CLOSED = "VCD_DEVTOOLS_CLOSED"
}
export const enum IpcCommands {
RPC_ACTIVITY = "rpc:activity",
RPC_INVITE = "rpc:invite",
RPC_DEEP_LINK = "rpc:link",
NAVIGATE_SETTINGS = "navigate:settings",
GET_LANGUAGES = "navigator.languages"
GET_LANGUAGES = "navigator.languages",
SCREEN_SHARE_PICKER = "screenshare:picker"
}

View File

@@ -16,6 +16,7 @@ export interface Settings {
enableMenu?: boolean;
disableSmoothScroll?: boolean;
hardwareAcceleration?: boolean;
hardwareVideoAcceleration?: boolean;
arRPC?: boolean;
appBadge?: boolean;
disableMinSize?: boolean;

15
src/shared/utils/text.ts Normal file
View File

@@ -0,0 +1,15 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2025 Vendicated and Vesktop contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
export function stripIndent(strings: TemplateStringsArray, ...values: any[]) {
const string = String.raw({ raw: strings }, ...values);
const match = string.match(/^[ \t]*(?=\S)/gm);
if (!match) return string.trim();
const minIndent = match.reduce((r, a) => Math.min(r, a.length), Infinity);
return string.replace(new RegExp(`^[ \\t]{${minIndent}}`, "gm"), "").trim();
}

View File

@@ -1,4 +1,6 @@
<head>
<title>About Vesktop</title>
<link rel="stylesheet" href="./style.css" type="text/css" />
<style>
@@ -9,19 +11,25 @@
h1 {
text-align: center;
}
ul {
display: flex;
flex-direction: column;
gap: 0.5em;
}
</style>
</head>
<body>
<h1 id="title">Vesktop</h1>
<p>
Vesktop is a free/libre cross platform desktop app aiming to give you a snappier Discord experience with Vencord
pre-installed
</p>
<h1 id="title">Vesktop v{{APP_VERSION}}</h1>
<p>Vesktop is a cross platform Discord Desktop client, aiming to give you a better Discord experience</p>
<section>
<h2>Links</h2>
<ul>
<li>
<a href="https://vesktop.vencord.dev/wiki" target="_blank">Vesktop Wiki</a>
</li>
<li>
<a href="https://vencord.dev" target="_blank">Vencord Website</a>
</li>
@@ -34,6 +42,17 @@
</ul>
</section>
<section>
<h2>License</h2>
<p>
Vesktop is licensed under the
<a href="https://www.gnu.org/licenses/gpl-3.0.txt" target="_blank">GNU General Public License v3.0</a>.
<br />
This is free software, and you are welcome to redistribute it under certain conditions; see the license for
details.
</p>
</section>
<section>
<h2>Acknowledgements</h2>
<p>These awesome libraries empower Vesktop</p>
@@ -53,23 +72,36 @@
</li>
<li>
<a href="https://github.com/Soundux/rohrkabel" target="_blank">rohrkabel</a>
- A C++ RAII Pipewire-API Wrapper
- A C++ RAII Pipewire-API Wrapper
</li>
<li>
And many
<a href="https://github.com/Vencord/Vesktop/blob/main/pnpm-lock.yaml" target="_blank"
>more awesome open source libraries</a
>more open source libraries</a
>
</li>
</ul>
</section>
</body>
<script type="module">
const data = await Updater.getData();
if (data.currentVersion) {
const title = document.getElementById("title");
<script>
const data = new URLSearchParams(location.search);
title.textContent += ` v${data.currentVersion}`;
// replace all {{FOO}} placeholders in the document with the values from the URL
/** @param {Node} [node] */
function walk(node) {
if (node.nodeType === Node.TEXT_NODE) {
node.textContent = node.textContent.replace(/{{(\w+)}}/g, (match, key) => data.get(key) || match);
return;
}
if (node.nodeType === Node.ELEMENT_NODE && node.nodeName !== "SCRIPT") {
for (const child of node.childNodes) {
walk(child);
}
}
}
walk(document.body);
</script>

View File

@@ -1,4 +1,6 @@
<head>
<title>Vesktop Setup</title>
<link rel="stylesheet" href="./style.css" type="text/css" />
<style>

View File

@@ -6,6 +6,7 @@
background: none;
user-select: none;
-webkit-app-region: drag;
overflow: hidden;
}
.wrapper {
@@ -20,6 +21,14 @@
background: var(--bg);
}
.message {
top: 70%;
word-break: break-word;
padding: 0 16px;
position: absolute;
font-size: 14px
}
p {
text-align: center;
}
@@ -41,5 +50,15 @@
role="presentation"
/>
<p>Loading Vesktop...</p>
<p class="message"></p>
</div>
</body>
<script>
document.addEventListener("DOMContentLoaded", () => {
const messageElement = document.querySelector('.message');
VesktopSplashNative.onUpdateMessage(message => {
messageElement.textContent = message;
})
});
</script>

View File

@@ -4,6 +4,7 @@
--fg-secondary: #313338;
--fg-semi-trans: rgb(0 0 0 / 0.2);
--link: #006ce7;
--link-hover: #005bb5;
}
@media (prefers-color-scheme: dark) {
@@ -13,6 +14,7 @@
--fg-secondary: #b5bac1;
--fg-semi-trans: rgb(255 255 255 / 0.2);
--link: #00a8fc;
--link-hover: #0086c3;
}
}
@@ -27,4 +29,9 @@ body {
a {
color: var(--link);
transition: color 0.2s linear;
}
a:hover {
color: var(--link-hover);
}