/* * SPDX-License-Identifier: GPL-3.0 * Vesktop, a desktop app aiming to give you a snappier Discord Experience * Copyright (c) 2023 Vendicated and Vencord contributors */ import "./settings.css"; import { Margins } from "@vencord/types/utils"; import { Button, Forms, Select, Slider, Switch, Text, Toasts, useEffect, useState } from "@vencord/types/webpack/common"; import { setBadge } from "renderer/appBadge"; import { useSettings } from "renderer/settings"; import { isMac } from "renderer/utils"; import { isTruthy } from "shared/utils/guards"; export default function SettingsUi() { const Settings = useSettings(); const supportsWindowsTransparency = VesktopNative.app.supportsWindowsTransparency(); const { autostart } = VesktopNative; const [autoStartEnabled, setAutoStartEnabled] = useState(autostart.isEnabled()); const [zoomFactor, setZoomFactor] = useState(Settings.zoomFactor ?? 1); useEffect(() => { const handleZoomChange = event => { console.log("zoom changed", event.detail); setZoomFactor(event.detail); }; window.addEventListener("zoomChanged", handleZoomChange); return () => { window.removeEventListener("zoomChanged", handleZoomChange); }; }, []); const allSwitches: Array boolean)?]> = [ [ "customTitleBar", "Discord Titlebar", "Use Discord's custom title bar instead of the native system one. Requires a full restart." ], !isMac && ["tray", "Tray Icon", "Add a tray icon for Vesktop", true], !isMac && [ "minimizeToTray", "Minimize to tray", "Hitting X will make Vesktop minimize to the tray instead of closing", true, () => Settings.tray ?? true ], ["arRPC", "Rich Presence", "Enables Rich Presence via arRPC", false], [ "disableMinSize", "Disable minimum window size", "Allows you to make the window as small as your heart desires" ], ["staticTitle", "Static Title", 'Makes the window title "Vesktop" instead of changing to the current page'], [ "enableMenu", "Enable Menu Bar", "Enables the application menu bar. Press ALT to toggle visibility. Incompatible with 'Discord Titlebar'" ], ["disableSmoothScroll", "Disable smooth scrolling", "Disables smooth scrolling in Vesktop", false], ["hardwareAcceleration", "Hardware Acceleration", "Enable hardware acceleration", true], ["splashTheming", "Splash theming", "Adapt the splash window colors to your custom theme", false], [ "openLinksWithElectron", "Open Links in app (experimental)", "Opens links in a new Vesktop window instead of your web browser" ], ["checkUpdates", "Check for updates", "Automatically check for Vesktop updates", true] ]; const switches = allSwitches.filter(isTruthy); return ( Vesktop Settings Discord Branch (Settings.transparencyOption = v)} isSelected={v => v === Settings.transparencyOption} serialize={s => s} /> )} <> Zoom Level { Settings.zoomFactor = v; VesktopNative.win.zoom(v); setZoomFactor(v); }} minValue={0.5} maxValue={2} markers={[0.5, 0.67, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2]} stickToMarkers={true} onMarkerRender={v => (v === 1 ? "100" : `${Math.round(v * 100)}`)} > Vencord Location Vencord files are loaded from{" "} {Settings.vencordDir ? ( { e.preventDefault(); VesktopNative.fileManager.showItemInFolder(Settings.vencordDir!); }} > {Settings.vencordDir} ) : ( "the default location" )}
); }