mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-21 02:48:00 +00:00
multi-window fixes
This commit is contained in:
@@ -117,6 +117,9 @@ export class Window {
|
||||
}
|
||||
|
||||
send (event, ...args) {
|
||||
if (!this.window) {
|
||||
return
|
||||
}
|
||||
this.window.webContents.send(event, ...args)
|
||||
}
|
||||
|
||||
@@ -154,19 +157,31 @@ export class Window {
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.on('window-focus', () => {
|
||||
ipcMain.on('window-focus', event => {
|
||||
if (event.sender !== this.window.webContents) {
|
||||
return
|
||||
}
|
||||
this.window.focus()
|
||||
})
|
||||
|
||||
ipcMain.on('window-maximize', () => {
|
||||
ipcMain.on('window-maximize', event => {
|
||||
if (event.sender !== this.window.webContents) {
|
||||
return
|
||||
}
|
||||
this.window.maximize()
|
||||
})
|
||||
|
||||
ipcMain.on('window-unmaximize', () => {
|
||||
ipcMain.on('window-unmaximize', event => {
|
||||
if (event.sender !== this.window.webContents) {
|
||||
return
|
||||
}
|
||||
this.window.unmaximize()
|
||||
})
|
||||
|
||||
ipcMain.on('window-toggle-maximize', () => {
|
||||
ipcMain.on('window-toggle-maximize', event => {
|
||||
if (event.sender !== this.window.webContents) {
|
||||
return
|
||||
}
|
||||
if (this.window.isMaximized()) {
|
||||
this.window.unmaximize()
|
||||
} else {
|
||||
@@ -174,23 +189,38 @@ export class Window {
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.on('window-minimize', () => {
|
||||
ipcMain.on('window-minimize', event => {
|
||||
if (event.sender !== this.window.webContents) {
|
||||
return
|
||||
}
|
||||
this.window.minimize()
|
||||
})
|
||||
|
||||
ipcMain.on('window-set-bounds', (_event, bounds) => {
|
||||
ipcMain.on('window-set-bounds', (event, bounds) => {
|
||||
if (event.sender !== this.window.webContents) {
|
||||
return
|
||||
}
|
||||
this.window.setBounds(bounds)
|
||||
})
|
||||
|
||||
ipcMain.on('window-set-always-on-top', (_event, flag) => {
|
||||
ipcMain.on('window-set-always-on-top', (event, flag) => {
|
||||
if (event.sender !== this.window.webContents) {
|
||||
return
|
||||
}
|
||||
this.window.setAlwaysOnTop(flag)
|
||||
})
|
||||
|
||||
ipcMain.on('window-set-vibrancy', (_event, enabled, type) => {
|
||||
ipcMain.on('window-set-vibrancy', (event, enabled, type) => {
|
||||
if (event.sender !== this.window.webContents) {
|
||||
return
|
||||
}
|
||||
this.setVibrancy(enabled, type)
|
||||
})
|
||||
|
||||
ipcMain.on('window-set-title', (_event, title) => {
|
||||
ipcMain.on('window-set-title', (event, title) => {
|
||||
if (event.sender !== this.window.webContents) {
|
||||
return
|
||||
}
|
||||
this.window.setTitle(title)
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user