Add ability to remove discord's minimum size restriction
This commit is contained in:
parent
a33279ea71
commit
826aa7999c
|
@ -10,3 +10,4 @@ export const OPEN_DEVTOOLS = "bd-open-devtools";
|
|||
export const CLOSE_DEVTOOLS = "bd-close-devtools";
|
||||
export const OPEN_WINDOW = "bd-open-window";
|
||||
export const INSPECT_ELEMENT = "bd-inspect-element";
|
||||
export const MINIMUM_SIZE = "bd-minimum-size";
|
|
@ -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;
|
||||
|
@ -116,3 +113,7 @@ export default class BetterDiscord {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
import Builtin from "../../structs/builtin";
|
||||
import IPC from "../../modules/ipc";
|
||||
|
||||
export default new class RemoveMinimumSize extends Builtin {
|
||||
get name() {return "RemoveMinimumSize";}
|
||||
get category() {return "appearance";}
|
||||
get id() {return "removeMinimumSize";}
|
||||
|
||||
enabled() {
|
||||
IPC.setMinimumSize(1, 1);
|
||||
}
|
||||
|
||||
disabled() {
|
||||
IPC.setMinimumSize(940, 500);
|
||||
}
|
||||
};
|
|
@ -12,6 +12,7 @@ export {default as ColoredText} from "./appearance/coloredtext";
|
|||
export {default as HideGIFButton} from "./appearance/hidegifbutton";
|
||||
export {default as HideGiftButton} from "./appearance/hidegiftbutton";
|
||||
export {default as MinimalMode} from "./appearance/minimalmode";
|
||||
export {default as RemoveMinimumSize} from "./appearance/removeminimumsize";
|
||||
|
||||
export {default as EmoteModule} from "./emotes/emotes";
|
||||
export {default as EmoteMenu} from "./emotes/emotemenu";
|
||||
|
|
|
@ -20,7 +20,8 @@ export default [
|
|||
{type: "switch", id: "hideGiftButton", value: false},
|
||||
{type: "switch", id: "hideGIFButton", value: false},
|
||||
{type: "switch", id: "minimalMode", value: false},
|
||||
{type: "switch", id: "coloredText", value: false}
|
||||
{type: "switch", id: "coloredText", value: false},
|
||||
{type: "switch", id: "removeMinimumSize", value: false}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -47,6 +47,10 @@ export default {
|
|||
hideGiftButton: {
|
||||
name: "Hide Gift Button",
|
||||
note: "Hides the Nitro Gift button in the textarea"
|
||||
},
|
||||
removeMinimumSize: {
|
||||
name: "Remove Minimum Size",
|
||||
note: "Removes Discord's forced minimum window size of 940x500"
|
||||
}
|
||||
},
|
||||
addons: {
|
||||
|
|
|
@ -33,6 +33,10 @@ export default new class IPCRenderer {
|
|||
}
|
||||
|
||||
inspectElement() {
|
||||
ipc.send(IPCEvents.INSPECT_ELEMENT);
|
||||
return ipc.send(IPCEvents.INSPECT_ELEMENT);
|
||||
}
|
||||
|
||||
setMinimumSize(width, height) {
|
||||
return ipc.send(IPCEvents.MINIMUM_SIZE, width, height);
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue