Windows: Add Option to use native titlebar ~ Closes #537

This commit is contained in:
Vendicated 2023-02-28 22:17:39 +01:00
parent 5ec517875e
commit 4918d699d5
No known key found for this signature in database
GPG Key ID: A1DC0CFB5615D905
4 changed files with 20 additions and 2 deletions

@ -95,3 +95,12 @@ async function init() {
} }
init(); init();
if (!IS_WEB && Settings.winNativeTitleBar && navigator.platform.toLowerCase().startsWith("win")) {
document.addEventListener("DOMContentLoaded", () => {
document.head.append(Object.assign(document.createElement("style"), {
id: "vencord-native-titlebar-style",
textContent: "[class*=titleBar-]{display: none!important}"
}));
}, { once: true });
}

@ -34,6 +34,7 @@ export interface Settings {
frameless: boolean; frameless: boolean;
transparent: boolean; transparent: boolean;
winCtrlQ: boolean; winCtrlQ: boolean;
winNativeTitleBar: boolean;
plugins: { plugins: {
[plugin: string]: { [plugin: string]: {
enabled: boolean; enabled: boolean;
@ -57,6 +58,7 @@ const DefaultSettings: Settings = {
frameless: false, frameless: false,
transparent: false, transparent: false,
winCtrlQ: false, winCtrlQ: false,
winNativeTitleBar: false,
plugins: {}, plugins: {},
notifications: { notifications: {

@ -63,11 +63,15 @@ function VencordSettings() {
title: "Enable React Developer Tools", title: "Enable React Developer Tools",
note: "Requires a full restart" note: "Requires a full restart"
}, },
!IS_WEB && !isWindows && { !IS_WEB && (!isWindows ? {
key: "frameless", key: "frameless",
title: "Disable the window frame", title: "Disable the window frame",
note: "Requires a full restart" note: "Requires a full restart"
}, } : {
key: "winNativeTitleBar",
title: "Use Windows' native title bar instead of Discord's custom one",
note: "Requires a full restart"
}),
!IS_WEB && { !IS_WEB && {
key: "transparent", key: "transparent",
title: "Enable window transparency", title: "Enable window transparency",

@ -79,7 +79,10 @@ if (!process.argv.includes("--vanilla")) {
options.webPreferences.sandbox = false; options.webPreferences.sandbox = false;
if (settings.frameless) { if (settings.frameless) {
options.frame = false; options.frame = false;
} else if (process.platform === "win32" && settings.winNativeTitleBar) {
delete options.frame;
} }
if (settings.transparent) { if (settings.transparent) {
options.transparent = true; options.transparent = true;
options.backgroundColor = "#00000000"; options.backgroundColor = "#00000000";