mirror of
https://github.com/Elvanos/fantasia-archive.git
synced 2024-06-22 16:10:18 +12:00
41 lines
944 B
TypeScript
41 lines
944 B
TypeScript
|
import { BrowserWindow } from '@electron/remote'
|
||
|
import { I_faWindowControlAPI } from 'src/interfaces/I_faWindowControlAPI'
|
||
|
|
||
|
export const faWindowControlAPI: I_faWindowControlAPI = {
|
||
|
|
||
|
checkWindowMaximized () {
|
||
|
const currentWindow = BrowserWindow.getFocusedWindow()
|
||
|
if (currentWindow !== null) {
|
||
|
return currentWindow.isMaximized()
|
||
|
}
|
||
|
return false
|
||
|
},
|
||
|
|
||
|
minimizeWindow () {
|
||
|
const currentWindow = BrowserWindow.getFocusedWindow()
|
||
|
|
||
|
if (currentWindow !== null) {
|
||
|
currentWindow.minimize()
|
||
|
}
|
||
|
},
|
||
|
|
||
|
resizeWindow () {
|
||
|
const currentWindow = BrowserWindow.getFocusedWindow()
|
||
|
|
||
|
if (currentWindow !== null) {
|
||
|
if (currentWindow.isMaximized()) {
|
||
|
currentWindow.unmaximize()
|
||
|
} else {
|
||
|
currentWindow.maximize()
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
|
||
|
closeWindow () {
|
||
|
const currentWindow = BrowserWindow.getFocusedWindow()
|
||
|
if (currentWindow !== null) {
|
||
|
currentWindow.close()
|
||
|
}
|
||
|
}
|
||
|
}
|