4
0
mirror of https://github.com/AltarikMC/Launcher synced 2024-11-24 06:39:50 +01:00
Launcher/include/menubar.js

42 lines
990 B
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,
}