2 Commits

Author SHA1 Message Date
Vendicated
5f01dfdbd0 [WP] migrate to new Vencord components 2025-11-20 00:03:47 +01:00
Vendicated
13e7e4491f fix misleading filename 2025-11-18 17:35:21 +01:00
38 changed files with 868 additions and 804 deletions

View File

@@ -6,34 +6,17 @@
//@ts-check
import { defineConfig } from "eslint/config";
import stylistic from "@stylistic/eslint-plugin";
import pathAlias from "eslint-plugin-path-alias";
import react from "eslint-plugin-react";
import simpleHeader from "eslint-plugin-simple-header";
import importSort from "eslint-plugin-simple-import-sort";
import unusedImports from "eslint-plugin-unused-imports";
import tseslint from "typescript-eslint";
import prettier from "eslint-plugin-prettier";
export default defineConfig(
export default tseslint.config(
{ ignores: ["dist"] },
{
files: ["src/**/*.{tsx,ts,mts,mjs,js,jsx}"],
settings: {
react: {
version: "19"
}
},
...react.configs.flat.recommended,
rules: {
...react.configs.flat.recommended.rules,
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"react/display-name": "off",
"react/no-unescaped-entities": "off"
}
},
{
files: ["src/**/*.{tsx,ts,mts,mjs,js,jsx}"],
plugins: {
@@ -41,10 +24,8 @@ export default defineConfig(
stylistic,
importSort,
unusedImports,
// @ts-expect-error Missing types
pathAlias,
prettier,
"@typescript-eslint": tseslint.plugin
prettier
},
settings: {
"import/resolver": {
@@ -70,6 +51,7 @@ export default defineConfig(
],
// ESLint Rules
yoda: "error",
eqeqeq: ["error", "always", { null: "ignore" }],
"prefer-destructuring": [
@@ -85,19 +67,8 @@ export default defineConfig(
"no-invalid-regexp": "error",
"no-constant-condition": ["error", { checkLoops: false }],
"no-duplicate-imports": "error",
"@typescript-eslint/dot-notation": [
"error",
{
allowPrivateClassPropertyAccess: true,
allowProtectedClassPropertyAccess: true
}
],
"no-useless-escape": [
"error",
{
allowRegexCharacters: ["i"]
}
],
"dot-notation": "error",
"no-useless-escape": "error",
"no-fallthrough": "error",
"for-direction": "error",
"no-async-promise-executor": "error",
@@ -114,7 +85,7 @@ export default defineConfig(
"no-unsafe-optional-chaining": "error",
"no-useless-backreference": "error",
"use-isnan": "error",
"prefer-const": ["error", { destructuring: "all" }],
"prefer-const": "error",
"prefer-spread": "error",
// Styling Rules

View File

@@ -35,29 +35,28 @@
},
"devDependencies": {
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
"@stylistic/eslint-plugin": "^5.6.1",
"@types/node": "^25.0.1",
"@stylistic/eslint-plugin": "^5.5.0",
"@types/node": "^24.10.1",
"@types/react": "19.2.1",
"@vencord/types": "^1.13.7",
"@vencord/types": "^1.13.2",
"dotenv": "^17.2.3",
"electron": "^39.2.7",
"electron": "^39.2.1",
"electron-builder": "^26.0.12",
"esbuild": "^0.27.1",
"esbuild": "^0.27.0",
"eslint": "^9.39.1",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-path-alias": "^2.1.0",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-simple-header": "^1.2.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unused-imports": "^4.3.0",
"libvesktop": "link:packages/libvesktop",
"prettier": "^3.7.4",
"prettier": "^3.6.2",
"source-map-support": "^0.5.21",
"tsx": "^4.21.0",
"type-fest": "^5.3.1",
"tsx": "^4.20.6",
"type-fest": "^5.2.0",
"typescript": "^5.9.3",
"typescript-eslint": "^8.49.0",
"typescript-eslint": "^8.47.0",
"xml-formatter": "^3.6.7"
},
"packageManager": "pnpm@10.7.1",
@@ -202,16 +201,6 @@
"fpm": [
"--rpm-rpmbuild-define=_build_id_links none"
]
},
"electronFuses": {
"runAsNode": false,
"enableCookieEncryption": false,
"enableNodeOptionsEnvironmentVariable": false,
"enableNodeCliInspectArguments": false,
"enableEmbeddedAsarIntegrityValidation": false,
"onlyLoadAppFromAsar": true,
"loadBrowserProcessSpecificV8Snapshot": false,
"grantFileProtocolExtraPrivileges": false
}
},
"pnpm": {

1096
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -142,11 +142,6 @@ handle(IpcEvents.SELECT_VENCORD_DIR, async (_e, value?: null) => {
handle(IpcEvents.SET_BADGE_COUNT, (_, count: number) => setBadgeCount(count));
handle(IpcEvents.FLASH_FRAME, (_, flag: boolean) => {
if (!mainWin || mainWin.isDestroyed() || (flag && mainWin.isFocused())) return;
mainWin.flashFrame(flag);
});
handle(IpcEvents.CLIPBOARD_COPY_IMAGE, async (_, buf: ArrayBuffer, src: string) => {
clipboard.write({
html: `<img src="${src.replaceAll('"', '\\"')}">`,

View File

@@ -312,7 +312,7 @@ function buildBrowserWindowOptions(): BrowserWindowConstructorOptions {
const { staticTitle, transparencyOption, enableMenu, customTitleBar, splashTheming, splashBackground } =
Settings.store;
const { frameless, transparent, macosVibrancyStyle } = VencordSettings.store;
const { frameless, transparent, macosTranslucency } = VencordSettings.store;
const noFrame = frameless === true || customTitleBar === true;
const backgroundColor =
@@ -358,9 +358,9 @@ function buildBrowserWindowOptions(): BrowserWindowConstructorOptions {
options.titleBarStyle = "hidden";
options.trafficLightPosition = { x: 10, y: 10 };
if (macosVibrancyStyle) {
options.vibrancy = macosVibrancyStyle;
options.backgroundColor = "#00000000";
if (macosTranslucency) {
options.vibrancy = "sidebar";
options.backgroundColor = "#ffffff00";
}
}
@@ -389,10 +389,6 @@ function createMainWindow() {
return false;
});
win.on("focus", () => {
win.flashFrame(false);
});
initWindowBoundsListeners(win);
if (!isDeckGameMode && (Settings.store.tray ?? true) && process.platform !== "darwin")
initTray(win, q => (isQuitting = q));

View File

@@ -4,7 +4,6 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { type Settings as TVencordSettings } from "@vencord/types/Vencord";
import { mkdirSync, readFileSync, writeFileSync } from "fs";
import { dirname, join } from "path";
import type { Settings as TSettings, State as TState } from "shared/settings";
@@ -28,17 +27,13 @@ function loadSettings<T extends object = any>(file: string, name: string) {
const store = new SettingsStore(settings);
store.addGlobalChangeListener(o => {
try {
mkdirSync(dirname(file), { recursive: true });
writeFileSync(file, JSON.stringify(o, null, 4));
} catch (err) {
console.error(`Failed to save settings to ${name}.json:`, err);
}
mkdirSync(dirname(file), { recursive: true });
writeFileSync(file, JSON.stringify(o, null, 4));
});
return store;
}
export const Settings = loadSettings<TSettings>(SETTINGS_FILE, "Vesktop settings");
export const VencordSettings = loadSettings<TVencordSettings>(VENCORD_SETTINGS_FILE, "Vencord settings");
export const VencordSettings = loadSettings<any>(VENCORD_SETTINGS_FILE, "Vencord settings");
export const State = loadSettings<TState>(STATE_FILE, "Vesktop state");

View File

@@ -68,7 +68,6 @@ export const VesktopNative = {
close: (key?: string) => invoke<void>(IpcEvents.CLOSE, key),
minimize: (key?: string) => invoke<void>(IpcEvents.MINIMIZE, key),
maximize: (key?: string) => invoke<void>(IpcEvents.MAXIMIZE, key),
flashFrame: (flag: boolean) => invoke<void>(IpcEvents.FLASH_FRAME, flag),
setDevtoolsCallbacks: (onOpen: () => void, onClose: () => void) => {
onDevtoolsOpen = onOpen;
onDevtoolsClose = onClose;

View File

@@ -4,7 +4,6 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import type arRpcPlugin from "@vencord/types/plugins/arRPC.web";
import { Logger } from "@vencord/types/utils";
import { findLazy, findStoreLazy, onceReady } from "@vencord/types/webpack";
import { FluxDispatcher, InviteActions } from "@vencord/types/webpack/common";
@@ -16,7 +15,9 @@ import { Settings } from "./settings";
const logger = new Logger("VesktopRPC", "#5865f2");
const StreamerModeStore = findStoreLazy("StreamerModeStore");
const arRPC = Vencord.Plugins.plugins["WebRichPresence (arRPC)"] as typeof arRpcPlugin;
const arRPC = Vencord.Plugins.plugins["WebRichPresence (arRPC)"] as any as {
handleEvent(e: MessageEvent): void;
};
onIpcCommand(IpcCommands.RPC_ACTIVITY, async jsonData => {
if (!Settings.store.arRPC) return;

View File

@@ -7,39 +7,16 @@
import "./screenSharePicker.css";
import { classNameFactory } from "@vencord/types/api/Styles";
import {
BaseText,
Button,
Card,
CogWheel,
FormSwitch,
Heading,
HeadingTertiary,
Margins,
Paragraph,
RestartIcon,
Span
} from "@vencord/types/components";
import {
closeModal,
Logger,
ModalCloseButton,
Modals,
ModalSize,
openModal,
useAwaiter,
useForceUpdater
} from "@vencord/types/utils";
import { Button, Card, CogWheel, FormSwitch, Heading, Paragraph, RestartIcon } from "@vencord/types/components";
import { closeModal, Logger, Modals, ModalSize, openModal, useAwaiter, useForceUpdater } from "@vencord/types/utils";
import { onceReady } from "@vencord/types/webpack";
import { FluxDispatcher, Select, UserStore, useState } from "@vencord/types/webpack/common";
import { Node } from "@vencord/venmic";
import type { Dispatch, SetStateAction } from "react";
import { MediaEngineStore } from "renderer/common";
import { isLinux, isWindows } from "renderer/constants";
import { addPatch } from "renderer/patches/shared";
import { State, useSettings, useVesktopState } from "renderer/settings";
import { isLinux, isWindows } from "renderer/utils";
import { SimpleErrorBoundary } from "./SimpleErrorBoundary";
const StreamResolutions = ["480", "720", "1080", "1440", "2160"] as const;
const StreamFps = ["15", "30", "60"] as const;
@@ -83,16 +60,16 @@ const logger = new Logger("VesktopScreenShare");
addPatch({
patches: [
{
find: "this.getDefaultGoliveQuality()",
find: "this.localWant=",
replacement: {
match: /this\.getDefaultGoliveQuality\(\)/,
replace: "$self.patchStreamQuality($&)"
match: /this.localWant=/,
replace: "$self.patchStreamQuality(this);$&"
}
}
],
patchStreamQuality(opts: any) {
const { screenshareQuality } = State.store;
if (!screenshareQuality) return opts;
if (!screenshareQuality) return;
const framerate = Number(screenshareQuality.frameRate);
const height = Number(screenshareQuality.resolution);
@@ -117,7 +94,6 @@ addPatch({
height,
pixelCount: height * width
});
return opts;
}
});
@@ -169,9 +145,6 @@ export function openScreenSharePicker(screens: Source[], skipPicker: boolean) {
onCloseRequest() {
closeModal(key);
reject("Aborted");
},
onCloseCallback() {
reject("Aborted");
}
}
);
@@ -192,7 +165,9 @@ function ScreenPicker({ screens, chooseScreen }: { screens: Source[]; chooseScre
/>
<img src={url} alt="" />
<Paragraph className={cl("screen-name")}>{name}</Paragraph>
<Paragraph className={cl("screen-name")} size="sm">
{name}
</Paragraph>
</label>
))}
</div>
@@ -213,16 +188,21 @@ function AudioSettingsModal({
return (
<Modals.ModalRoot {...modalProps} size={ModalSize.MEDIUM}>
<Modals.ModalHeader className={cl("header")}>
<BaseText size="lg" weight="semibold" tag="h3" style={{ flexGrow: 1 }}>
Audio Settings
</BaseText>
<ModalCloseButton onClick={close} />
<Heading tag="h2" className={cl("header-title")}>
Venmic Settings
</Heading>
<Modals.ModalCloseButton onClick={close} className={cl("header-close-button")} />
</Modals.ModalHeader>
<Modals.ModalContent className={cl("modal", "venmic-settings")}>
<FormSwitch
title="Microphone Workaround"
description="Work around an issue that causes the microphone to be shared instead of the correct audio. Only enable if you're experiencing this issue."
description={
<>
Work around an issue that causes the microphone to be shared instead of the correct audio.
Only enable if you're experiencing this issue.
</>
}
hideBorder
onChange={v => (Settings.audio = { ...Settings.audio, workaround: v })}
value={Settings.audio?.workaround ?? false}
@@ -230,7 +210,10 @@ function AudioSettingsModal({
<FormSwitch
title="Only Speakers"
description={
'When sharing entire desktop audio, only share apps that play to a speaker. You may want to disable this when using "mix bussing".'
<>
When sharing entire desktop audio, only share apps that play to a speaker. You may want to
disable this when using "mix bussing".
</>
}
hideBorder
onChange={v => (Settings.audio = { ...Settings.audio, onlySpeakers: v })}
@@ -250,7 +233,7 @@ function AudioSettingsModal({
/>
<FormSwitch
title="Ignore Inputs"
description="Exclude nodes that are intended to capture audio."
description={<>Exclude nodes that are intended to capture audio.</>}
hideBorder
onChange={v => (Settings.audio = { ...Settings.audio, ignoreInputMedia: v })}
value={Settings.audio?.ignoreInputMedia ?? true}
@@ -258,7 +241,10 @@ function AudioSettingsModal({
<FormSwitch
title="Ignore Virtual"
description={
'Exclude virtual nodes, such as nodes belonging to loopbacks. This might be useful when using "mix bussing".'
<>
Exclude virtual nodes, such as nodes belonging to loopbacks. This might be useful when using
"mix bussing".
</>
}
hideBorder
onChange={v => (Settings.audio = { ...Settings.audio, ignoreVirtual: v })}
@@ -266,7 +252,7 @@ function AudioSettingsModal({
/>
<FormSwitch
title="Ignore Devices"
description="Exclude device nodes, such as nodes belonging to microphones or speakers."
description={<>Exclude device nodes, such as nodes belonging to microphones or speakers.</>}
hideBorder
onChange={v =>
(Settings.audio = {
@@ -279,7 +265,7 @@ function AudioSettingsModal({
/>
<FormSwitch
title="Granular Selection"
description="Allow to select applications more granularly."
description={<>Allow to select applications more granularly.</>}
hideBorder
onChange={value => {
Settings.audio = { ...Settings.audio, granularSelect: value };
@@ -326,7 +312,9 @@ function OptionRadio<Settings extends object, Key extends keyof Settings>(props:
<div className={cl("option-radios")}>
{(options as string[]).map((option, idx) => (
<label className={cl("option-radio")} data-checked={settings[settingsKey] === option} key={option}>
<Span weight="bold">{labels?.[idx] ?? option}</Span>
<Paragraph size="sm" weight="bold">
{labels?.[idx] ?? option}
</Paragraph>
<input
className={cl("option-input")}
type="radio"
@@ -377,18 +365,18 @@ function StreamSettingsUi({
return (
<div>
<HeadingTertiary className={Margins.bottom8}>What you're streaming</HeadingTertiary>
<Heading>What you're streaming</Heading>
<Card className={cl("card", "preview")}>
<img src={thumb} alt="" className={cl(isLinux ? "preview-img-linux" : "preview-img")} />
<Paragraph>{source.name}</Paragraph>
<Paragraph size="sm">{source.name}</Paragraph>
</Card>
<HeadingTertiary className={Margins.bottom8}>Stream Settings</HeadingTertiary>
<Heading>Stream Settings</Heading>
<Card className={cl("card")}>
<div className={cl("quality")}>
<section className={cl("quality-section")}>
<Heading tag="h5">Resolution</Heading>
<Heading>Resolution</Heading>
<OptionRadio
options={StreamResolutions}
settings={qualitySettings}
@@ -398,7 +386,7 @@ function StreamSettingsUi({
</section>
<section className={cl("quality-section")}>
<Heading tag="h5">Frame Rate</Heading>
<Heading>Frame Rate</Heading>
<OptionRadio
options={StreamFps}
settings={qualitySettings}
@@ -409,7 +397,7 @@ function StreamSettingsUi({
</div>
<div className={cl("quality")}>
<section className={cl("quality-section")}>
<Heading tag="h5">Content Type</Heading>
<Heading>Content Type</Heading>
<div>
<OptionRadio
options={["motion", "detail"]}
@@ -418,11 +406,12 @@ function StreamSettingsUi({
settingsKey="contentHint"
onChange={option => setSettings(s => ({ ...s, contentHint: option }))}
/>
<Paragraph className={Margins.top8}>
Choosing "Prefer Clarity" will result in a significantly lower framerate in exchange for
a much sharper and clearer image.
</Paragraph>
<div className={cl("hint-description")}>
<p>
Choosing "Prefer Clarity" will result in a significantly lower framerate in exchange
for a much sharper and clearer image.
</p>
</div>
</div>
{isWindows && (
<FormSwitch
@@ -595,15 +584,11 @@ function AudioSourcePickerLinux({
return (
<Paragraph>
Failed to retrieve Audio Sources because your C++ library is too old to run
<a href="https://github.com/Vencord/venmic" target="_blank" rel="noreferrer">
<a href="https://github.com/Vencord/venmic" target="_blank">
venmic
</a>
. See{" "}
<a
href="https://gist.github.com/Vendicated/b655044ffbb16b2716095a448c6d827a"
target="_blank"
rel="noreferrer"
>
<a href="https://gist.github.com/Vendicated/b655044ffbb16b2716095a448c6d827a" target="_blank">
this guide
</a>{" "}
for possible solutions.
@@ -613,13 +598,9 @@ function AudioSourcePickerLinux({
if (!hasPipewirePulse && !ignorePulseWarning) {
return (
<Paragraph>
<Paragraph size="sm">
Could not find pipewire-pulse. See{" "}
<a
href="https://gist.github.com/the-spyke/2de98b22ff4f978ebf0650c90e82027e#install"
target="_blank"
rel="noreferrer"
>
<a href="https://gist.github.com/the-spyke/2de98b22ff4f978ebf0650c90e82027e#install" target="_blank">
this guide
</a>{" "}
on how to switch to pipewire. <br />
@@ -646,41 +627,37 @@ function AudioSourcePickerLinux({
<>
<div className={cl("audio-sources")}>
<section>
<Heading tag="h5">{loading ? "Loading Sources..." : "Audio Sources"}</Heading>
<SimpleErrorBoundary>
<Heading>{loading ? "Loading Sources..." : "Audio Sources"}</Heading>
<Select
options={allSources.map(({ name, value }) => ({
label: name,
value: value,
default: name === "None"
}))}
isSelected={isItemSelected(includeSources)}
select={updateItems(setIncludeSources, includeSources)}
serialize={String}
popoutPosition="top"
closeOnSelect={false}
/>
</section>
{includeSources === "Entire System" && (
<section>
<Heading>Exclude Sources</Heading>
<Select
options={allSources.map(({ name, value }) => ({
label: name,
value: value,
default: name === "None"
}))}
isSelected={isItemSelected(includeSources)}
select={updateItems(setIncludeSources, includeSources)}
options={allSources
.filter(x => x.name !== "Entire System")
.map(({ name, value }) => ({
label: name,
value: value,
default: name === "None"
}))}
isSelected={isItemSelected(excludeSources)}
select={updateItems(setExcludeSources, excludeSources)}
serialize={String}
popoutPosition="top"
closeOnSelect={false}
/>
</SimpleErrorBoundary>
</section>
{includeSources === "Entire System" && (
<section>
<Heading tag="h5">Exclude Sources</Heading>
<SimpleErrorBoundary>
<Select
options={allSources
.filter(x => x.name !== "Entire System")
.map(({ name, value }) => ({
label: name,
value: value,
default: name === "None"
}))}
isSelected={isItemSelected(excludeSources)}
select={updateItems(setExcludeSources, excludeSources)}
serialize={String}
popoutPosition="top"
closeOnSelect={false}
/>
</SimpleErrorBoundary>
</section>
)}
</div>
@@ -725,11 +702,12 @@ function ModalComponent({
return (
<Modals.ModalRoot {...modalProps} size={ModalSize.MEDIUM}>
<Modals.ModalHeader className={cl("header")}>
<BaseText size="lg" weight="semibold" tag="h3" style={{ flexGrow: 1 }}>
Screen Share Picker
</BaseText>
<ModalCloseButton onClick={close} />
<Heading tag="h2" className={cl("header-title")}>
ScreenShare
</Heading>
<Modals.ModalCloseButton onClick={close} className={cl("header-close-button")} />
</Modals.ModalHeader>
<Modals.ModalContent className={cl("modal")}>
{!selected ? (
<ScreenPicker screens={screens} chooseScreen={setSelected} />

View File

@@ -1,46 +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 { Card, ErrorBoundary, HeadingTertiary, Paragraph, TextButton } from "@vencord/types/components";
import { FluxDispatcher, InviteActions } from "@vencord/types/webpack/common";
import type { PropsWithChildren } from "react";
async function openSupportChannel() {
const code = "YVbdG2ZRG4";
try {
const { invite } = await InviteActions.resolveInvite(code, "Desktop Modal");
if (!invite) throw 0;
await FluxDispatcher.dispatch({
type: "INVITE_MODAL_OPEN",
invite,
code,
context: "APP"
});
} catch {
window.open(`https://discord.gg/${code}`, "_blank");
}
}
function Fallback() {
return (
<Card variant="danger">
<HeadingTertiary>Something went wrong.</HeadingTertiary>
<Paragraph>
Please make sure Vencord and Vesktop are fully up to date. You can get help in our{" "}
<TextButton variant="link" onClick={openSupportChannel}>
Support Channel
</TextButton>
</Paragraph>
</Card>
);
}
export function SimpleErrorBoundary({ children }: PropsWithChildren<{}>) {
return <ErrorBoundary fallback={Fallback}>{children}</ErrorBoundary>;
}

View File

@@ -18,9 +18,10 @@
.vcd-screen-picker-card {
flex-grow: 1;
padding: 0.5em;
box-sizing: border-box;
}
/* Screen Grid */
.vcd-screen-picker-screen-grid {
display: grid;
@@ -54,11 +55,6 @@
margin-inline: 0.5em;
}
.vcd-screen-picker-card {
padding: 0.5em;
box-sizing: border-box;
}
.vcd-screen-picker-preview-img-linux {
width: 60%;
margin-bottom: 0.5em;
@@ -81,13 +77,13 @@
/* Option Radios */
.vcd-screen-picker-option-radios {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
display: flex;
width: 100%;
border-radius: 3px;
}
.vcd-screen-picker-option-radio {
flex: 1 1 auto;
text-align: center;
background-color: var(--background-secondary);
border: 1px solid var(--primary-800);
@@ -151,4 +147,11 @@
>section {
flex: 1;
}
}
.vcd-screen-picker-hint-description {
color: var(--header-secondary);
font-size: 14px;
line-height: 20px;
font-weight: 400;
}

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { BaseText, Button, Heading, Paragraph, TextButton } from "@vencord/types/components";
import { Heading, Paragraph } from "@vencord/types/components";
import {
Margins,
ModalCloseButton,
@@ -15,7 +15,7 @@ import {
openModal,
useForceUpdater
} from "@vencord/types/utils";
import { Toasts } from "@vencord/types/webpack/common";
import { Button, Text, Toasts } from "@vencord/types/webpack/common";
import { Settings } from "shared/settings";
import { cl, SettingsComponent } from "./Settings";
@@ -28,9 +28,9 @@ function openDeveloperOptionsModal(settings: Settings) {
openModal(props => (
<ModalRoot {...props} size={ModalSize.MEDIUM}>
<ModalHeader>
<BaseText size="lg" weight="semibold" tag="h3" style={{ flexGrow: 1 }}>
<Text variant="heading-lg/semibold" style={{ flexGrow: 1 }}>
Vesktop Developer Options
</BaseText>
</Text>
<ModalCloseButton onClick={props.onClose} />
</ModalHeader>
@@ -63,21 +63,22 @@ const VencordLocationPicker: SettingsComponent = ({ settings }) => {
<Paragraph>
Vencord files are loaded from{" "}
{vencordDir ? (
<TextButton
variant="link"
<a
href="about:blank"
onClick={e => {
e.preventDefault();
VesktopNative.fileManager.showItemInFolder(vencordDir!);
}}
>
{vencordDir}
</TextButton>
</a>
) : (
"the default location"
)}
</Paragraph>
<div className={cl("button-grid")}>
<Button
size={Button.Sizes.SMALL}
onClick={async () => {
const choice = await VesktopNative.fileManager.selectVencordDir();
switch (choice) {
@@ -105,7 +106,8 @@ const VencordLocationPicker: SettingsComponent = ({ settings }) => {
Change
</Button>
<Button
variant="dangerPrimary"
size={Button.Sizes.SMALL}
color={Button.Colors.RED}
onClick={async () => {
await VesktopNative.fileManager.selectVencordDir(null);
forceUpdate();

View File

@@ -4,14 +4,14 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { ErrorBoundary } from "@vencord/types/components";
import { Select } from "@vencord/types/webpack/common";
import { SimpleErrorBoundary } from "../SimpleErrorBoundary";
import { SettingsComponent } from "./Settings";
export const DiscordBranchPicker: SettingsComponent = ({ settings }) => {
return (
<SimpleErrorBoundary>
<ErrorBoundary noop>
<Select
placeholder="Stable"
options={[
@@ -24,6 +24,6 @@ export const DiscordBranchPicker: SettingsComponent = ({ settings }) => {
isSelected={v => v === settings.discordBranch}
serialize={s => s}
/>
</SimpleErrorBoundary>
</ErrorBoundary>
);
};

View File

@@ -1,27 +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 { Button, Card, HeadingTertiary, Paragraph } from "@vencord/types/components";
import { useAwaiter } from "@vencord/types/utils";
import { cl } from "./Settings";
export function OutdatedVesktopWarning() {
const [isOutdated] = useAwaiter(VesktopNative.app.isOutdated);
if (!isOutdated) return null;
return (
<Card variant="warning" className={cl("updater-card")}>
<HeadingTertiary>Your Vesktop is outdated!</HeadingTertiary>
<Paragraph>Staying up to date is important for security and stability.</Paragraph>
<Button onClick={() => VesktopNative.app.openUpdater()} variant="secondary">
Open Updater
</Button>
</Card>
);
}

View File

@@ -7,16 +7,17 @@
import "./settings.css";
import { classNameFactory } from "@vencord/types/api/Styles";
import { BaseText, Divider, ErrorBoundary } from "@vencord/types/components";
import { Divider, ErrorBoundary } from "@vencord/types/components";
import { Text } from "@vencord/types/webpack/common";
import { ComponentType } from "react";
import { isMac, isWindows } from "renderer/constants";
import { Settings, useSettings } from "renderer/settings";
import { isMac, isWindows } from "renderer/utils";
import { AutoStartToggle } from "./AutoStartToggle";
import { DeveloperOptionsButton } from "./DeveloperOptions";
import { DiscordBranchPicker } from "./DiscordBranchPicker";
import { NotificationBadgeToggle } from "./NotificationBadgeToggle";
import { OutdatedVesktopWarning } from "./OutdatedVesktopWarning";
import { Updater } from "./Updater";
import { UserAssetsButton } from "./UserAssets";
import { VesktopSettingsSwitch } from "./VesktopSettingsSwitch";
import { WindowsTransparencyControls } from "./WindowsTransparencyControls";
@@ -124,15 +125,7 @@ const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>>
defaultValue: false
}
],
Notifications: [
NotificationBadgeToggle,
{
key: "enableTaskbarFlashing",
title: "Enable Taskbar Flashing",
description: "Flashes the app in your taskbar when you have new notifications.",
defaultValue: false
}
],
Notifications: [NotificationBadgeToggle],
Miscellaneous: [
{
key: "arRPC",
@@ -156,13 +149,13 @@ function SettingsSections() {
const sections = Object.entries(SettingsOptions).map(([title, settings], i, arr) => (
<div key={title} className={cl("category")}>
<BaseText size="lg" weight="semibold" tag="h3" className={cl("category-title")}>
<Text variant="heading-lg/semibold" color="header-primary" className={cl("category-title")}>
{title}
</BaseText>
</Text>
<div className={cl("category-content")}>
{settings.map((Setting, i) => {
if (typeof Setting === "function") return <Setting key={`Custom-${i}`} settings={Settings} />;
{settings.map(Setting => {
if (typeof Setting === "function") return <Setting settings={Settings} />;
const { defaultValue, title, description, key, disabled, invisible } = Setting;
if (invisible?.()) return null;
@@ -191,7 +184,10 @@ export default ErrorBoundary.wrap(
function SettingsUI() {
return (
<section>
<OutdatedVesktopWarning />
<Text variant="heading-xl/semibold" color="header-primary" className={cl("title")}>
Vesktop Settings
</Text>
<Updater />
<SettingsSections />
</section>
);

View File

@@ -0,0 +1,36 @@
/*
* 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 { Paragraph } from "@vencord/types/components";
import { useAwaiter } from "@vencord/types/utils";
import { Button } from "@vencord/types/webpack/common";
import { cl } from "./Settings";
export function Updater() {
const [isOutdated] = useAwaiter(VesktopNative.app.isOutdated);
if (!isOutdated) return null;
return (
<div className={cl("updater-card")}>
<Paragraph size="md" weight="semibold">
Your Vesktop is outdated!
</Paragraph>
<Paragraph size="sm" weight="normal">
Staying up to date is important for security and stability.
</Paragraph>
<Button
onClick={() => VesktopNative.app.openUpdater()}
size={Button.Sizes.SMALL}
color={Button.Colors.TRANSPARENT}
>
Open Updater
</Button>
</div>
);
}

View File

@@ -6,7 +6,7 @@
import "./UserAssets.css";
import { BaseText, Button, FormSwitch } from "@vencord/types/components";
import { FormSwitch, Heading } from "@vencord/types/components";
import {
Margins,
ModalCloseButton,
@@ -18,7 +18,7 @@ import {
wordsFromCamel,
wordsToTitle
} from "@vencord/types/utils";
import { showToast, useState } from "@vencord/types/webpack/common";
import { Button, showToast, Text, useState } from "@vencord/types/webpack/common";
import { UserAssetType } from "main/userAssets";
import { useSettings } from "renderer/settings";
@@ -34,9 +34,9 @@ function openAssetsModal() {
openModal(props => (
<ModalRoot {...props} size={ModalSize.MEDIUM}>
<ModalHeader>
<BaseText size="lg" weight="semibold" tag="h3" style={{ flexGrow: 1 }}>
<Text variant="heading-lg/semibold" style={{ flexGrow: 1 }}>
User Assets
</BaseText>
</Text>
<ModalCloseButton onClick={props.onClose} />
</ModalHeader>
@@ -73,9 +73,7 @@ function Asset({ asset }: { asset: UserAssetType }) {
return (
<section>
<BaseText size="md" weight="medium" tag="h3">
{wordsToTitle(wordsFromCamel(asset))}
</BaseText>
<Heading tag="h3">{wordsToTitle(wordsFromCamel(asset))}</Heading>
<div className="vcd-user-assets-asset">
<img
className="vcd-user-assets-image"
@@ -86,7 +84,7 @@ function Asset({ asset }: { asset: UserAssetType }) {
<div className="vcd-user-assets-actions">
<div className="vcd-user-assets-buttons">
<Button onClick={onChooseAsset()}>Customize</Button>
<Button variant="secondary" onClick={onChooseAsset(null)}>
<Button color={Button.Colors.PRIMARY} onClick={onChooseAsset(null)}>
Reset to default
</Button>
</div>

View File

@@ -5,7 +5,7 @@
*/
import { FormSwitch } from "@vencord/types/components";
import type { ComponentProps } from "react";
import { ComponentProps } from "react";
import { cl } from "./Settings";

View File

@@ -4,24 +4,23 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { Heading, Paragraph } from "@vencord/types/components";
import { ErrorBoundary, Heading, Paragraph } from "@vencord/types/components";
import { Margins } from "@vencord/types/utils";
import { Select } from "@vencord/types/webpack/common";
import { SimpleErrorBoundary } from "../SimpleErrorBoundary";
import { SettingsComponent } from "./Settings";
export const WindowsTransparencyControls: SettingsComponent = ({ settings }) => {
if (!VesktopNative.app.supportsWindowsTransparency()) return null;
return (
<div>
<Heading tag="h5">Transparency Options</Heading>
<Paragraph className={Margins.bottom8}>
Requires a full restart. You will need a theme that supports transparency for this to work.
</Paragraph>
<ErrorBoundary noop>
<div>
<Heading>Transparency Options</Heading>
<Paragraph className={Margins.bottom8}>
Requires a full restart. You will need a theme that supports transparency for this to work.
</Paragraph>
<SimpleErrorBoundary>
<Select
placeholder="None"
options={[
@@ -45,7 +44,7 @@ export const WindowsTransparencyControls: SettingsComponent = ({ settings }) =>
isSelected={v => v === settings.transparencyOption}
serialize={s => s}
/>
</SimpleErrorBoundary>
</div>
</div>
</ErrorBoundary>
);
};

View File

@@ -38,4 +38,10 @@
margin-bottom: 1em;
display: grid;
gap: 0.5em;
border-radius: 8px;
background-color: var(--bg-secondary);
background: var(--background-feedback-warning);
border: 1px solid var(--info-warning-foreground);
color: var(--text-feedback-warning);
}

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { localStorage } from "./utils";
import { localStorage } from "./constants";
// Make clicking Notifications focus the window
const originalSetOnClick = Object.getOwnPropertyDescriptor(Notification.prototype, "onclick")!.set!;

View File

@@ -23,8 +23,7 @@ import type SettingsPlugin from "@vencord/types/plugins/_core/settings";
VesktopLogger.log("read if cute :3");
VesktopLogger.log("Vesktop v" + VesktopNative.app.getVersion());
// TODO
const customSettingsSections = (Vencord.Plugins.plugins.Settings as typeof SettingsPlugin).customSections;
const customSettingsSections = (Vencord.Plugins.plugins.Settings as any as typeof SettingsPlugin).customSections;
customSettingsSections.push(() => ({
section: "Vesktop",

View File

@@ -26,10 +26,12 @@ addPatch({
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

@@ -11,6 +11,8 @@ addPatch({
{
find: '"NotificationSettingsStore',
replacement: {
// FIXME: fix eslint rule
// eslint-disable-next-line no-useless-escape
match: /\.isPlatformEmbedded(?=\?\i\.\i\.ALL)/g,
replace: "$&||true"
}

View File

@@ -11,6 +11,7 @@ addPatch({
{
find: "lastOutputSystemDevice.justChanged",
replacement: {
// eslint-disable-next-line no-useless-escape
match: /(\i)\.\i\.getState\(\).neverShowModal/,
replace: "$& || $self.shouldIgnoreDevice($1)"
}

View File

@@ -11,6 +11,7 @@ addPatch({
{
find: 'setSinkId"in',
replacement: {
// eslint-disable-next-line no-useless-escape
match: /return (\i)\?navigator\.mediaDevices\.enumerateDevices/,
replace: "return $1 ? $self.filteredDevices"
}

View File

@@ -4,8 +4,8 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { isMac } from "renderer/constants";
import { Settings } from "renderer/settings";
import { isMac } from "renderer/utils";
import { addPatch } from "./shared";
@@ -14,6 +14,7 @@ addPatch({
{
find: "platform-web",
replacement: {
// eslint-disable-next-line no-useless-escape
match: /(?<=" platform-overlay"\):)\i/,
replace: "$self.getPlatformClass()"
}

View File

@@ -6,8 +6,8 @@
import { Logger } from "@vencord/types/utils";
import { currentSettings } from "renderer/components/ScreenSharePicker";
import { isLinux } from "renderer/constants";
import { State } from "renderer/settings";
import { isLinux } from "renderer/utils";
const logger = new Logger("VesktopStreamFixes");

View File

@@ -23,7 +23,7 @@ addPatch({
find: ".enableSpellCheck)",
replacement: {
// if (isDesktop) { DiscordNative.onSpellcheck(openMenu(props)) } else { e.preventDefault(); openMenu(props) }
match: /else (\i)\.preventDefault\(\),(\i\(\i\))(?<=:(\i)\.enableSpellCheck\).+?)/,
match: /else (.{1,3})\.preventDefault\(\),(.{1,3}\(.{1,3}\))(?<=:(.{1,3})\.enableSpellCheck\).+?)/,
// ... else { $self.onSlateContext(() => openMenu(props)) }
replace: "else {$self.onSlateContext($1, $3?.enableSpellCheck, () => $2)}"
}
@@ -66,7 +66,6 @@ addContextMenuPatch("textarea-context", children => {
<>
{corrections.map(c => (
<Menu.MenuItem
key={c}
id={"vcd-spellcheck-suggestion-" + c}
label={c}
action={() => VesktopNative.spellcheck.replaceMisspelling(c)}
@@ -96,7 +95,6 @@ addContextMenuPatch("textarea-context", children => {
const isEnabled = spellCheckLanguages.includes(lang);
return (
<Menu.MenuCheckboxItem
key={lang}
id={"vcd-spellcheck-lang-" + lang}
label={lang}
checked={isEnabled}

View File

@@ -12,6 +12,7 @@ addPatch({
find: ".STREAMER_MODE_ENABLE,",
replacement: {
// remove if (platformEmbedded) check from streamer mode toggle
// eslint-disable-next-line no-useless-escape
match: /if\(\i\.\i\)(?=return.{0,200}?"autoToggle")/g,
replace: ""
}

View File

@@ -1,27 +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 { Settings } from "renderer/settings";
import { addPatch } from "./shared";
addPatch({
patches: [
{
find: ".flashFrame(!0)",
replacement: {
match: /(\i)&&\i\.\i\.taskbarFlash&&\i\.\i\.flashFrame\(!0\)/,
replace: "$self.flashFrame()"
}
}
],
flashFrame() {
if (Settings.store.enableTaskbarFlashing) {
VesktopNative.win.flashFrame(true);
}
}
});

View File

@@ -12,10 +12,13 @@ addPatch({
find: ",setSystemTrayApplications",
replacement: [
{
// eslint-disable-next-line no-useless-escape
match: /\i\.window\.(close|minimize|maximize)/g,
replace: `VesktopNative.win.$1`
},
{
// TODO: Fix eslint rule
// eslint-disable-next-line no-useless-escape
match: /(focus(\(\i\)){).{0,150}?\.focus\(\i,\i\)/,
replace: "$1VesktopNative.win.focus$2"
},

View File

@@ -15,6 +15,8 @@ if (Settings.store.customTitleBar)
find: ".wordmarkWindows",
replacement: [
{
// TODO: Fix eslint rule
// eslint-disable-next-line no-useless-escape
match: /case \i\.\i\.WINDOWS:/,
replace: 'case "WEB":'
}
@@ -25,10 +27,14 @@ if (Settings.store.customTitleBar)
find: ".systemBar,",
replacement: [
{
// TODO: Fix eslint rule
// eslint-disable-next-line no-useless-escape
match: /\i===\i\.PlatformTypes\.WINDOWS/g,
replace: "true"
},
{
// TODO: Fix eslint rule
// eslint-disable-next-line no-useless-escape
match: /\i===\i\.PlatformTypes\.WEB/g,
replace: "false"
}

View File

@@ -7,8 +7,8 @@
import { useEffect, useReducer } from "@vencord/types/webpack/common";
import { SettingsStore } from "shared/utils/SettingsStore";
import { localStorage } from "./constants";
import { VesktopLogger } from "./logger";
import { localStorage } from "./utils";
export const Settings = new SettingsStore(VesktopNative.settings.get());
Settings.addGlobalChangeListener((o, p) => VesktopNative.settings.set(o, p));

View File

@@ -60,7 +60,7 @@ const updateSplashColors = () => {
const bodyStyles = document.body.computedStyleMap();
const color = bodyStyles.get("--text-default");
const backgroundColor = bodyStyles.get("--background-base-lowest");
const backgroundColor = bodyStyles.get("--background-primary");
if (isValidColor(color)) {
Settings.store.splashColor = resolveColor(color[0]);

View File

@@ -36,7 +36,6 @@ export const enum IpcEvents {
SPELLCHECK_ADD_TO_DICTIONARY = "VCD_SPELLCHECK_ADD_TO_DICTIONARY",
SET_BADGE_COUNT = "VCD_SET_BADGE_COUNT",
FLASH_FRAME = "FLASH_FRAME",
CAPTURER_GET_LARGE_THUMBNAIL = "VCD_CAPTURER_GET_LARGE_THUMBNAIL",

View File

@@ -20,7 +20,6 @@ export interface Settings {
hardwareVideoAcceleration?: boolean;
arRPC?: boolean;
appBadge?: boolean;
enableTaskbarFlashing?: boolean;
disableMinSize?: boolean;
clickTrayToShowHide?: boolean;
customTitleBar?: boolean;