Upload files to 'src/renderer/components/settings'
parent
f5af0deb31
commit
0f54a36223
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: GPL-3.0
|
||||||
|
* Aerocord, a vesktop fork for older microsoft NT releases such as NT 6.0, 6.1, 6.2 and 6.3.
|
||||||
|
* Credits to vendicated and the rest of the vesktop contribuitors for making Vesktop!
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Switch, useState } from "@vencord/types/webpack/common";
|
||||||
|
|
||||||
|
import { SettingsComponent } from "./Settings";
|
||||||
|
|
||||||
|
export const AutoStartToggle: SettingsComponent = () => {
|
||||||
|
const [autoStartEnabled, setAutoStartEnabled] = useState(VesktopNative.autostart.isEnabled());
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Switch
|
||||||
|
value={autoStartEnabled}
|
||||||
|
onChange={async v => {
|
||||||
|
await VesktopNative.autostart[v ? "enable" : "disable"]();
|
||||||
|
setAutoStartEnabled(v);
|
||||||
|
}}
|
||||||
|
note="Automatically start Vesktop on computer start-up"
|
||||||
|
>
|
||||||
|
Start With System
|
||||||
|
</Switch>
|
||||||
|
);
|
||||||
|
};
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: GPL-3.0
|
||||||
|
* Aerocord, a vesktop fork for older microsoft NT releases such as NT 6.0, 6.1, 6.2 and 6.3.
|
||||||
|
* Credits to vendicated and the rest of the vesktop contribuitors for making Vesktop!
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Select } from "@vencord/types/webpack/common";
|
||||||
|
|
||||||
|
import { SettingsComponent } from "./Settings";
|
||||||
|
|
||||||
|
export const DiscordBranchPicker: SettingsComponent = ({ settings }) => {
|
||||||
|
return (
|
||||||
|
<Select
|
||||||
|
placeholder="Stable"
|
||||||
|
options={[
|
||||||
|
{ label: "Stable", value: "stable", default: true },
|
||||||
|
{ label: "Canary", value: "canary" },
|
||||||
|
{ label: "PTB", value: "ptb" }
|
||||||
|
]}
|
||||||
|
closeOnSelect={true}
|
||||||
|
select={v => (settings.discordBranch = v)}
|
||||||
|
isSelected={v => v === settings.discordBranch}
|
||||||
|
serialize={s => s}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: GPL-3.0
|
||||||
|
* Aerocord, a vesktop fork for older microsoft NT releases such as NT 6.0, 6.1, 6.2 and 6.3.
|
||||||
|
* Credits to vendicated and the rest of the vesktop contribuitors for making Vesktop!
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Switch } from "@vencord/types/webpack/common";
|
||||||
|
import { setBadge } from "renderer/appBadge";
|
||||||
|
|
||||||
|
import { SettingsComponent } from "./Settings";
|
||||||
|
|
||||||
|
export const NotificationBadgeToggle: SettingsComponent = ({ settings }) => {
|
||||||
|
return (
|
||||||
|
<Switch
|
||||||
|
value={settings.appBadge ?? true}
|
||||||
|
onChange={v => {
|
||||||
|
settings.appBadge = v;
|
||||||
|
if (v) setBadge();
|
||||||
|
else VesktopNative.app.setBadgeCount(0);
|
||||||
|
}}
|
||||||
|
note="Show mention badge on the app icon"
|
||||||
|
>
|
||||||
|
Notification Badge
|
||||||
|
</Switch>
|
||||||
|
);
|
||||||
|
};
|
|
@ -0,0 +1,176 @@
|
||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: GPL-3.0
|
||||||
|
* Aerocord, a vesktop fork for older microsoft NT releases such as NT 6.0, 6.1, 6.2 and 6.3.
|
||||||
|
* Credits to vendicated and the rest of the vesktop contribuitors for making Vesktop!
|
||||||
|
*/
|
||||||
|
|
||||||
|
import "./settings.css";
|
||||||
|
|
||||||
|
import { Forms, Switch, Text } from "@vencord/types/webpack/common";
|
||||||
|
import { ComponentType } from "react";
|
||||||
|
import { Settings, useSettings } from "renderer/settings";
|
||||||
|
import { isMac, isWindows } from "renderer/utils";
|
||||||
|
|
||||||
|
import { AutoStartToggle } from "./AutoStartToggle";
|
||||||
|
import { DiscordBranchPicker } from "./DiscordBranchPicker";
|
||||||
|
import { NotificationBadgeToggle } from "./NotificationBadgeToggle";
|
||||||
|
import { VencordLocationPicker } from "./VencordLocationPicker";
|
||||||
|
import { WindowsTransparencyControls } from "./WindowsTransparencyControls";
|
||||||
|
|
||||||
|
interface BooleanSetting {
|
||||||
|
key: keyof typeof Settings.store;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
defaultValue: boolean;
|
||||||
|
disabled?(): boolean;
|
||||||
|
invisible?(): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type SettingsComponent = ComponentType<{ settings: typeof Settings.store }>;
|
||||||
|
|
||||||
|
const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>> = {
|
||||||
|
"Discord Branch": [DiscordBranchPicker],
|
||||||
|
"System Startup & Performance": [
|
||||||
|
AutoStartToggle,
|
||||||
|
{
|
||||||
|
key: "hardwareAcceleration",
|
||||||
|
title: "Hardware Acceleration",
|
||||||
|
description: "Enable hardware acceleration",
|
||||||
|
defaultValue: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"User Interface": [
|
||||||
|
{
|
||||||
|
key: "customTitleBar",
|
||||||
|
title: "Discord Titlebar",
|
||||||
|
description: "Use Discord's custom title bar instead of the native system one. Requires a full restart.",
|
||||||
|
defaultValue: isWindows
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "staticTitle",
|
||||||
|
title: "Static Title",
|
||||||
|
description: 'Makes the window title "Vesktop" instead of changing to the current page',
|
||||||
|
defaultValue: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "enableMenu",
|
||||||
|
title: "Enable Menu Bar",
|
||||||
|
description: "Enables the application menu bar. Press ALT to toggle visibility.",
|
||||||
|
defaultValue: false,
|
||||||
|
disabled: () => Settings.store.customTitleBar ?? isWindows
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "splashTheming",
|
||||||
|
title: "Splash theming",
|
||||||
|
description: "Adapt the splash window colors to your custom theme",
|
||||||
|
defaultValue: false
|
||||||
|
},
|
||||||
|
WindowsTransparencyControls
|
||||||
|
],
|
||||||
|
Behaviour: [
|
||||||
|
{
|
||||||
|
key: "tray",
|
||||||
|
title: "Tray Icon",
|
||||||
|
description: "Add a tray icon for Vesktop",
|
||||||
|
defaultValue: true,
|
||||||
|
invisible: () => isMac
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "minimizeToTray",
|
||||||
|
title: "Minimize to tray",
|
||||||
|
description: "Hitting X will make Vesktop minimize to the tray instead of closing",
|
||||||
|
defaultValue: true,
|
||||||
|
invisible: () => isMac,
|
||||||
|
disabled: () => Settings.store.tray === false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "clickTrayToShowHide",
|
||||||
|
title: "Hide/Show on tray click",
|
||||||
|
description: "Left clicking tray icon will toggle the vesktop window visibility.",
|
||||||
|
defaultValue: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "disableMinSize",
|
||||||
|
title: "Disable minimum window size",
|
||||||
|
description: "Allows you to make the window as small as your heart desires",
|
||||||
|
defaultValue: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "disableSmoothScroll",
|
||||||
|
title: "Disable smooth scrolling",
|
||||||
|
description: "Disables smooth scrolling",
|
||||||
|
defaultValue: false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Notifications & Updates": [
|
||||||
|
NotificationBadgeToggle,
|
||||||
|
{
|
||||||
|
key: "checkUpdates",
|
||||||
|
title: "Check for updates",
|
||||||
|
description: "Automatically check for Vesktop updates",
|
||||||
|
defaultValue: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
Miscelleanous: [
|
||||||
|
{
|
||||||
|
key: "arRPC",
|
||||||
|
title: "Rich Presence",
|
||||||
|
description: "Enables Rich Presence via arRPC",
|
||||||
|
defaultValue: false
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
key: "openLinksWithElectron",
|
||||||
|
title: "Open Links in app (experimental)",
|
||||||
|
description: "Opens links in a new Vesktop window instead of your web browser",
|
||||||
|
defaultValue: false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Vencord Location": [VencordLocationPicker]
|
||||||
|
};
|
||||||
|
|
||||||
|
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 { defaultValue, title, description, key, disabled, invisible } = Setting;
|
||||||
|
if (invisible?.()) return null;
|
||||||
|
|
||||||
|
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>
|
||||||
|
));
|
||||||
|
|
||||||
|
return <>{sections}</>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function SettingsUi() {
|
||||||
|
return (
|
||||||
|
<Forms.FormSection>
|
||||||
|
<Text variant="heading-lg/semibold" style={{ color: "var(--header-primary)" }} tag="h2">
|
||||||
|
Aerocord Settings
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<SettingsSections />
|
||||||
|
</Forms.FormSection>
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
.vcd-location-btns {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 0.5em;
|
||||||
|
margin-top: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vcd-settings-section {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vcd-settings-title {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
Loading…
Reference in New Issue