also allow using discord titlebar on non-windows
This commit is contained in:
parent
2aa0b0fa20
commit
2e4c834a90
6 changed files with 22 additions and 13 deletions
|
@ -374,11 +374,11 @@ function createMainWindow() {
|
||||||
removeSettingsListeners();
|
removeSettingsListeners();
|
||||||
removeVencordSettingsListeners();
|
removeVencordSettingsListeners();
|
||||||
|
|
||||||
const { staticTitle, transparencyOption, enableMenu, discordWindowsTitleBar } = Settings.store;
|
const { staticTitle, transparencyOption, enableMenu, customTitleBar } = Settings.store;
|
||||||
|
|
||||||
const { frameless } = VencordSettings.store;
|
const { frameless } = VencordSettings.store;
|
||||||
|
|
||||||
const noFrame = frameless === true || (process.platform === "win32" && discordWindowsTitleBar === true);
|
const noFrame = frameless === true || customTitleBar === true;
|
||||||
|
|
||||||
const win = (mainWin = new BrowserWindow({
|
const win = (mainWin = new BrowserWindow({
|
||||||
show: false,
|
show: false,
|
||||||
|
@ -398,7 +398,7 @@ function createMainWindow() {
|
||||||
backgroundMaterial: transparencyOption
|
backgroundMaterial: transparencyOption
|
||||||
}),
|
}),
|
||||||
// Fix transparencyOption for custom discord titlebar
|
// Fix transparencyOption for custom discord titlebar
|
||||||
...(discordWindowsTitleBar &&
|
...(customTitleBar &&
|
||||||
transparencyOption &&
|
transparencyOption &&
|
||||||
transparencyOption !== "none" && {
|
transparencyOption !== "none" && {
|
||||||
transparent: true
|
transparent: true
|
||||||
|
|
|
@ -35,9 +35,15 @@ function loadSettings<T extends object = any>(file: string, name: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Settings = loadSettings<TSettings>(SETTINGS_FILE, "Vesktop settings");
|
export const Settings = loadSettings<TSettings>(SETTINGS_FILE, "Vesktop settings");
|
||||||
|
if (Object.hasOwn(Settings.plain, "discordWindowsTitleBar")) {
|
||||||
|
Settings.plain.customTitleBar = Settings.plain.discordWindowsTitleBar;
|
||||||
|
delete Settings.plain.discordWindowsTitleBar;
|
||||||
|
Settings.markAsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
export const VencordSettings = loadSettings<any>(VENCORD_SETTINGS_FILE, "Vencord settings");
|
export const VencordSettings = loadSettings<any>(VENCORD_SETTINGS_FILE, "Vencord settings");
|
||||||
|
|
||||||
if (Object.hasOwn(Settings.store, "firstLaunch") && !existsSync(STATE_FILE)) {
|
if (Object.hasOwn(Settings.plain, "firstLaunch") && !existsSync(STATE_FILE)) {
|
||||||
console.warn("legacy state in settings.json detected. migrating to state.json");
|
console.warn("legacy state in settings.json detected. migrating to state.json");
|
||||||
const state = {} as TState;
|
const state = {} as TState;
|
||||||
for (const prop of [
|
for (const prop of [
|
||||||
|
@ -47,7 +53,7 @@ if (Object.hasOwn(Settings.store, "firstLaunch") && !existsSync(STATE_FILE)) {
|
||||||
"skippedUpdate",
|
"skippedUpdate",
|
||||||
"steamOSLayoutVersion",
|
"steamOSLayoutVersion",
|
||||||
"windowBounds"
|
"windowBounds"
|
||||||
]) {
|
] as const) {
|
||||||
state[prop] = Settings.plain[prop];
|
state[prop] = Settings.plain[prop];
|
||||||
delete Settings.plain[prop];
|
delete Settings.plain[prop];
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { Margins } from "@vencord/types/utils";
|
||||||
import { Button, Forms, Select, Switch, Text, Toasts, useState } from "@vencord/types/webpack/common";
|
import { Button, Forms, Select, Switch, Text, Toasts, useState } from "@vencord/types/webpack/common";
|
||||||
import { setBadge } from "renderer/appBadge";
|
import { setBadge } from "renderer/appBadge";
|
||||||
import { useSettings } from "renderer/settings";
|
import { useSettings } from "renderer/settings";
|
||||||
import { isMac, isWindows } from "renderer/utils";
|
import { isMac } from "renderer/utils";
|
||||||
import { isTruthy } from "shared/utils/guards";
|
import { isTruthy } from "shared/utils/guards";
|
||||||
|
|
||||||
export default function SettingsUi() {
|
export default function SettingsUi() {
|
||||||
|
@ -21,10 +21,10 @@ export default function SettingsUi() {
|
||||||
const [autoStartEnabled, setAutoStartEnabled] = useState(autostart.isEnabled());
|
const [autoStartEnabled, setAutoStartEnabled] = useState(autostart.isEnabled());
|
||||||
|
|
||||||
const allSwitches: Array<false | [keyof typeof Settings, string, string, boolean?, (() => boolean)?]> = [
|
const allSwitches: Array<false | [keyof typeof Settings, string, string, boolean?, (() => boolean)?]> = [
|
||||||
isWindows && [
|
[
|
||||||
"discordWindowsTitleBar",
|
"customTitleBar",
|
||||||
"Discord Titlebar",
|
"Discord Titlebar",
|
||||||
"Use Discord's custom title bar instead of the Windows one. Requires a full restart."
|
"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 && ["tray", "Tray Icon", "Add a tray icon for Vesktop", true],
|
||||||
!isMac && [
|
!isMac && [
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Settings } from "renderer/settings";
|
import { Settings } from "renderer/settings";
|
||||||
import { isMac, isWindows } from "renderer/utils";
|
import { isMac } from "renderer/utils";
|
||||||
|
|
||||||
import { addPatch } from "./shared";
|
import { addPatch } from "./shared";
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ addPatch({
|
||||||
],
|
],
|
||||||
|
|
||||||
getPlatformClass() {
|
getPlatformClass() {
|
||||||
|
if (Settings.store.customTitleBar) return "platform-win";
|
||||||
if (isMac) return "platform-osx";
|
if (isMac) return "platform-osx";
|
||||||
if (isWindows && Settings.store.discordWindowsTitleBar) return "platform-win";
|
|
||||||
return "platform-web";
|
return "platform-web";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { Settings } from "renderer/settings";
|
||||||
|
|
||||||
import { addPatch } from "./shared";
|
import { addPatch } from "./shared";
|
||||||
|
|
||||||
if (Settings.store.discordWindowsTitleBar)
|
if (Settings.store.customTitleBar)
|
||||||
addPatch({
|
addPatch({
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
|
|
5
src/shared/settings.d.ts
vendored
5
src/shared/settings.d.ts
vendored
|
@ -19,9 +19,12 @@ export interface Settings {
|
||||||
hardwareAcceleration?: boolean;
|
hardwareAcceleration?: boolean;
|
||||||
arRPC?: boolean;
|
arRPC?: boolean;
|
||||||
appBadge?: boolean;
|
appBadge?: boolean;
|
||||||
discordWindowsTitleBar?: boolean;
|
|
||||||
disableMinSize?: boolean;
|
disableMinSize?: boolean;
|
||||||
|
|
||||||
|
/** @deprecated use customTitleBar */
|
||||||
|
discordWindowsTitleBar?: boolean;
|
||||||
|
customTitleBar?: boolean;
|
||||||
|
|
||||||
checkUpdates?: boolean;
|
checkUpdates?: boolean;
|
||||||
|
|
||||||
splashTheming?: boolean;
|
splashTheming?: boolean;
|
||||||
|
|
Loading…
Reference in a new issue