Add ability to remove discord's minimum size restriction
This commit is contained in:
@@ -22,10 +22,6 @@ electron.app.once("ready", async () => {
|
||||
});
|
||||
|
||||
|
||||
if (BetterDiscord.getSetting("general", "mediaKeys")) {
|
||||
electron.app.commandLine.appendSwitch("disable-features", "HardwareMediaKeyHandling,MediaSessionService");
|
||||
}
|
||||
|
||||
let hasCrashed = false;
|
||||
export default class BetterDiscord {
|
||||
static getWindowPrefs() {
|
||||
@@ -86,6 +82,7 @@ export default class BetterDiscord {
|
||||
}
|
||||
|
||||
static setup(browserWindow) {
|
||||
|
||||
// Setup some useful vars to avoid blocking IPC calls
|
||||
process.env.DISCORD_PRELOAD = browserWindow.__originalPreload;
|
||||
process.env.DISCORD_APP_PATH = appPath;
|
||||
@@ -115,4 +112,8 @@ export default class BetterDiscord {
|
||||
hasCrashed = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (BetterDiscord.getSetting("general", "mediaKeys")) {
|
||||
electron.app.commandLine.appendSwitch("disable-features", "HardwareMediaKeyHandling,MediaSessionService");
|
||||
}
|
||||
@@ -70,6 +70,11 @@ const inspectElement = async event => {
|
||||
event.sender.devToolsWebContents.executeJavaScript("DevToolsAPI.enterInspectElementMode();");
|
||||
};
|
||||
|
||||
const setMinimumSize = (event, width, height) => {
|
||||
const window = BrowserWindow.fromWebContents(event.sender);
|
||||
window.setMinimumSize(width, height);
|
||||
};
|
||||
|
||||
export default class IPCMain {
|
||||
static registerEvents() {
|
||||
ipc.on(IPCEvents.GET_PATH, getPath);
|
||||
@@ -77,6 +82,7 @@ export default class IPCMain {
|
||||
ipc.on(IPCEvents.OPEN_DEVTOOLS, openDevTools);
|
||||
ipc.on(IPCEvents.CLOSE_DEVTOOLS, closeDevTools);
|
||||
ipc.on(IPCEvents.INSPECT_ELEMENT, inspectElement);
|
||||
ipc.on(IPCEvents.MINIMUM_SIZE, setMinimumSize);
|
||||
ipc.handle(IPCEvents.RUN_SCRIPT, runScript);
|
||||
ipc.handle(IPCEvents.OPEN_WINDOW, createBrowserWindow);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user