✨ Add ability to use native OS frame
Signed-off-by: Luka Leer <luka.leer@gmail.com>
This commit is contained in:
parent
78edeb77c6
commit
8a762e70d9
|
@ -39,7 +39,7 @@
|
|||
},
|
||||
"frame": {
|
||||
"name": "Window Frame",
|
||||
"note": "Adds the native os window frame to the main window"
|
||||
"note": "Adds the native OS window frame to the main window (requires restart)"
|
||||
}
|
||||
},
|
||||
"addons": {
|
||||
|
@ -237,6 +237,10 @@
|
|||
"enabledInfo": "This option requires a transparent theme in order to work properly. On Windows this may break your aero snapping and maximizing.\n\nIn order to take effect, Discord needs to be restarted. Do you want to restart now?",
|
||||
"disabledInfo": "In order to take effect, Discord needs to be restarted. Do you want to restart now?"
|
||||
},
|
||||
"NativeFrame": {
|
||||
"enabledInfo": "In order to take effect, Discord needs to be restarted. Do you want to restart now?",
|
||||
"disabledInfo": "In order to take effect, Discord needs to be restarted. Do you want to restart now?"
|
||||
},
|
||||
"Notices": {
|
||||
"moreInfo": "More Info"
|
||||
},
|
||||
|
|
|
@ -17,10 +17,17 @@ class BrowserWindow extends electron.BrowserWindow {
|
|||
}
|
||||
|
||||
// Only affect frame if it is *explicitly* set
|
||||
// const shouldHaveFrame = BetterDiscord.getSetting("window", "frame");
|
||||
// if (typeof(shouldHaveFrame) === "boolean") options.frame = shouldHaveFrame;
|
||||
const shouldHaveFrame = BetterDiscord.getSetting("window", "frame");
|
||||
if (typeof(shouldHaveFrame) === "boolean") options.frame = shouldHaveFrame;
|
||||
|
||||
super(options);
|
||||
|
||||
if (typeof(shouldHaveFrame) === "boolean" && shouldHaveFrame) {
|
||||
this.webContents.insertCSS(`div[class*="titleBar_"] {
|
||||
display: none !important;
|
||||
}`);
|
||||
}
|
||||
|
||||
this.__originalPreload = originalPreload;
|
||||
BetterDiscord.setup(this);
|
||||
}
|
||||
|
|
|
@ -18,4 +18,5 @@ export {default as StopDevToolsWarning} from "./developer/devtoolswarning";
|
|||
export {default as DebugLogs} from "./developer/debuglogs";
|
||||
|
||||
export {default as WindowPrefs} from "./window/transparency";
|
||||
export {default as NativeFrame} from "./window/frame";
|
||||
export {default as RemoveMinimumSize} from "./window/removeminimumsize";
|
|
@ -0,0 +1,33 @@
|
|||
import Builtin from "@structs/builtin";
|
||||
|
||||
import Strings from "@modules/strings";
|
||||
import IPC from "@modules/ipc";
|
||||
|
||||
import Modals from "@ui/modals";
|
||||
|
||||
|
||||
export default new class NativeFrame extends Builtin {
|
||||
get name() {return "NativeFrame";}
|
||||
get category() {return "window";}
|
||||
get id() {return "frame";}
|
||||
|
||||
enabled() {
|
||||
this.showModal(Strings.NativeFrame.enabledInfo);
|
||||
document.body.classList.add("bd-frame");
|
||||
}
|
||||
|
||||
disabled() {
|
||||
this.showModal(Strings.NativeFrame.disabledInfo);
|
||||
document.body.classList.remove("bd-frame");
|
||||
}
|
||||
|
||||
showModal(info) {
|
||||
if (!this.initialized) return;
|
||||
Modals.showConfirmationModal(Strings.Modals.additionalInfo, info, {
|
||||
confirmText: Strings.Modals.restartNow,
|
||||
cancelText: Strings.Modals.restartLater,
|
||||
danger: true,
|
||||
onConfirm: () => IPC.relaunch()
|
||||
});
|
||||
}
|
||||
};
|
|
@ -52,8 +52,8 @@ export default [
|
|||
shown: false,
|
||||
settings: [
|
||||
{type: "switch", id: "transparency", value: false},
|
||||
{type: "switch", id: "removeMinimumSize", value: false},
|
||||
{type: "switch", id: "frame", value: false, hidden: true}
|
||||
{type: "switch", id: "frame", value: false},
|
||||
{type: "switch", id: "removeMinimumSize", value: false}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue