4
0
mirror of https://github.com/AltarikMC/Launcher synced 2024-11-25 06:49:51 +01:00
Launcher/menubar.js
2020-12-05 21:08:32 +01:00

42 lines
1.0 KiB
JavaScript

const {remote} = require('electron');
const {Menu, BrowserWindow, MenuItem, shell} = remote;
function getCurrentWindow() {
return remote.getCurrentWindow();
}
function minimizeWindow(browserWindow = getCurrentWindow()) {
if (browserWindow.minimizable) {
// browserWindow.isMinimizable() for old electron versions
browserWindow.minimize();
}
}
function unmaximizeWindow(browserWindow = getCurrentWindow()) {
browserWindow.unmaximize();
}
function maxUnmaxWindow(browserWindow = getCurrentWindow()) {
if (browserWindow.isMaximized()) {
browserWindow.unmaximize();
} else {
browserWindow.maximize();
}
}
function closeWindow(browserWindow = getCurrentWindow()) {
browserWindow.close();
}
function isWindowMaximized(browserWindow = getCurrentWindow()) {
return browserWindow.isMaximized();
}
module.exports = {
getCurrentWindow,
minimizeWindow,
unmaximizeWindow,
maxUnmaxWindow,
isWindowMaximized,
closeWindow,
};