2023-09-09 09:54:44 +12:00
|
|
|
import { BrowserWindow } from '@electron/remote'
|
2023-09-13 07:20:26 +12:00
|
|
|
import { I_faWindowControlAPI } from 'app/interfaces/I_faWindowControlAPI'
|
2023-09-09 09:54:44 +12:00
|
|
|
|
|
|
|
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()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2023-09-14 08:37:05 +12:00
|
|
|
maximizeWindow () {
|
|
|
|
const currentWindow = BrowserWindow.getFocusedWindow()
|
|
|
|
|
|
|
|
if (currentWindow !== null) {
|
|
|
|
currentWindow.maximize()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2023-09-09 09:54:44 +12:00
|
|
|
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()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|