|
@@ -7,6 +7,7 @@ const sleep = (ms) => new Promise(res => setTimeout(res, ms));
|
|
|
class MainSerivce {
|
|
class MainSerivce {
|
|
|
#mqttChannel = null
|
|
#mqttChannel = null
|
|
|
#client = null
|
|
#client = null
|
|
|
|
|
+ #isMin = 1
|
|
|
constructor() {
|
|
constructor() {
|
|
|
Menu.setApplicationMenu(null) // 去掉菜单栏
|
|
Menu.setApplicationMenu(null) // 去掉菜单栏
|
|
|
app.commandLine.appendSwitch('wm-window-animations-disabled') // 拖动闪屏
|
|
app.commandLine.appendSwitch('wm-window-animations-disabled') // 拖动闪屏
|
|
@@ -104,6 +105,14 @@ class MainSerivce {
|
|
|
this.mainWin.webContents.toggleDevTools()
|
|
this.mainWin.webContents.toggleDevTools()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ // 最小化
|
|
|
|
|
+ globalShortcut.register('Ctrl+B', () => {
|
|
|
|
|
+ if(this.#isMin & 1) {this.mainWin.hide()}else{
|
|
|
|
|
+ this.mainWin.show()
|
|
|
|
|
+ }
|
|
|
|
|
+ this.#isMin++
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
// 系统环境
|
|
// 系统环境
|
|
|
if (platform === 'win32') {
|
|
if (platform === 'win32') {
|
|
|
// 右键
|
|
// 右键
|
|
@@ -132,8 +141,7 @@ class MainSerivce {
|
|
|
this.#closeMqtt()
|
|
this.#closeMqtt()
|
|
|
this.mainWin.close()
|
|
this.mainWin.close()
|
|
|
} else if (evt === 'maxWin') {
|
|
} else if (evt === 'maxWin') {
|
|
|
- const { width, height } = screen.getPrimaryDisplay().size
|
|
|
|
|
- if (data) { this.mainWin.setBounds({ x: 0, y: 0, width, height }) } else {
|
|
|
|
|
|
|
+ if (data) { this.mainWin.maximize() } else {
|
|
|
this.mainWin.setBounds({ width: 1300, height: 760 })
|
|
this.mainWin.setBounds({ width: 1300, height: 760 })
|
|
|
this.mainWin.center()
|
|
this.mainWin.center()
|
|
|
}
|
|
}
|
|
@@ -177,6 +185,7 @@ class MainSerivce {
|
|
|
if (this.#client) this.#client.end()
|
|
if (this.#client) this.#client.end()
|
|
|
this.#client = null
|
|
this.#client = null
|
|
|
this.#mqttChannel = null
|
|
this.#mqttChannel = null
|
|
|
|
|
+ this.#isMin = 1
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
connectLogi() {
|
|
connectLogi() {
|