mirror of
https://github.com/AltarikMC/Launcher
synced 2024-11-22 06:19:50 +01:00
42 lines
990 B
JavaScript
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,
|
||
|
}
|