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

View File

@ -95,3 +95,12 @@ async function 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 });
}

View File

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

View File

@ -63,11 +63,15 @@ function VencordSettings() {
title: "Enable React Developer Tools",
note: "Requires a full restart"
},
!IS_WEB && !isWindows && {
!IS_WEB && (!isWindows ? {
key: "frameless",
title: "Disable the window frame",
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 && {
key: "transparent",
title: "Enable window transparency",

View File

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