Fix native titlebar setting
This commit is contained in:
parent
d3edab7ba8
commit
09210898a0
5 changed files with 21 additions and 21 deletions
|
|
@ -20,6 +20,8 @@
|
|||
import "~plugins";
|
||||
import "./fixWeirdAppRegionBug.css";
|
||||
|
||||
import nativeTitleBarStyles from "./nativeTitleBar.css?managed";
|
||||
|
||||
export * as Api from "./api";
|
||||
export * as Plugins from "./api/PluginManager";
|
||||
export * as Components from "./components";
|
||||
|
|
@ -29,11 +31,9 @@ export * as Webpack from "./webpack";
|
|||
export * as WebpackPatcher from "./webpack/patchWebpack";
|
||||
export { PlainSettings, Settings };
|
||||
|
||||
import { coreStyleRootNode, initStyles } from "@api/Styles";
|
||||
import { enableStyle, initStyles } from "@api/Styles";
|
||||
import { openSettingsTabModal, UpdaterTab } from "@components/settings";
|
||||
import { debounce } from "@shared/debounce";
|
||||
import { IS_WINDOWS } from "@utils/constants";
|
||||
import { createAndAppendStyle } from "@utils/css";
|
||||
import { StartAt } from "@utils/types";
|
||||
import { SettingsRouter } from "@webpack/common";
|
||||
|
||||
|
|
@ -181,8 +181,7 @@ init();
|
|||
document.addEventListener("DOMContentLoaded", () => {
|
||||
startAllPlugins(StartAt.DOMContentLoaded);
|
||||
|
||||
// FIXME
|
||||
if (IS_DISCORD_DESKTOP && Settings.winNativeTitleBar && IS_WINDOWS) {
|
||||
createAndAppendStyle("vencord-native-titlebar-style", coreStyleRootNode).textContent = "[class*=titleBar]{display: none!important}";
|
||||
if (IS_DISCORD_DESKTOP && Settings.nativeTitleBar) {
|
||||
enableStyle(nativeTitleBarStyles);
|
||||
}
|
||||
}, { once: true });
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export interface Settings {
|
|||
| undefined;
|
||||
windowsMaterial: "none" | "mica" | "tabbed" | "acrylic";
|
||||
disableMinSize: boolean;
|
||||
winNativeTitleBar: boolean;
|
||||
nativeTitleBar: boolean;
|
||||
plugins: {
|
||||
[plugin: string]: {
|
||||
enabled: boolean;
|
||||
|
|
@ -107,7 +107,7 @@ const DefaultSettings: Settings = {
|
|||
macosVibrancyStyle: undefined,
|
||||
windowsMaterial: "none",
|
||||
disableMinSize: false,
|
||||
winNativeTitleBar: false,
|
||||
nativeTitleBar: false,
|
||||
plugins: {},
|
||||
|
||||
uiElements: {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ type KeysOfType<Object, Type> = {
|
|||
}[keyof Object];
|
||||
|
||||
function Switches() {
|
||||
const settings = useSettings(["useQuickCss", "enableReactDevtools", "frameless", "winNativeTitleBar", "transparent", "winCtrlQ", "disableMinSize"]);
|
||||
const settings = useSettings(["useQuickCss", "enableReactDevtools", "frameless", "nativeTitleBar", "transparent", "winCtrlQ", "disableMinSize"]);
|
||||
|
||||
const Switches = [
|
||||
{
|
||||
|
|
@ -59,15 +59,11 @@ function Switches() {
|
|||
title: "Enable Custom CSS",
|
||||
description: "Apply your configured QuickCSS"
|
||||
},
|
||||
!IS_WEB && (!IS_DISCORD_DESKTOP || !IS_WINDOWS ? {
|
||||
key: "frameless",
|
||||
title: "Disable the window frame",
|
||||
IS_DISCORD_DESKTOP && {
|
||||
key: "nativeTitleBar",
|
||||
title: "Enable the system's title bar in addition to Discord's custom one",
|
||||
restartRequired: true
|
||||
} : {
|
||||
key: "winNativeTitleBar",
|
||||
title: "Use Windows' native title bar instead of Discord's custom one",
|
||||
restartRequired: true
|
||||
}),
|
||||
},
|
||||
!IS_WEB && {
|
||||
key: "transparent",
|
||||
title: "Enable window transparency",
|
||||
|
|
|
|||
|
|
@ -74,15 +74,13 @@ if (!IS_VANILLA) {
|
|||
return;
|
||||
}
|
||||
|
||||
const { frameless, winNativeTitleBar, disableMinSize, transparent, macosVibrancyStyle, windowsMaterial } = settings;
|
||||
const { nativeTitleBar, disableMinSize, transparent, macosVibrancyStyle, windowsMaterial } = settings;
|
||||
|
||||
const original = options.webPreferences.preload;
|
||||
options.webPreferences.preload = join(__dirname, "preload.js");
|
||||
options.webPreferences.sandbox = false;
|
||||
|
||||
if (frameless) {
|
||||
options.frame = false;
|
||||
} else if (process.platform === "win32" && winNativeTitleBar) {
|
||||
if (nativeTitleBar) {
|
||||
delete options.frame;
|
||||
}
|
||||
|
||||
|
|
|
|||
7
src/nativeTitleBar.css
Normal file
7
src/nativeTitleBar.css
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[class*="bar_"] {
|
||||
margin-inline-end: 12px !important;
|
||||
}
|
||||
|
||||
[class*="winButtons_"] {
|
||||
display: none !important;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue