mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-21 19:07:59 +00:00
multi-window fixes
This commit is contained in:
@@ -117,6 +117,9 @@ export class Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
send (event, ...args) {
|
send (event, ...args) {
|
||||||
|
if (!this.window) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.window.webContents.send(event, ...args)
|
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()
|
this.window.focus()
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('window-maximize', () => {
|
ipcMain.on('window-maximize', event => {
|
||||||
|
if (event.sender !== this.window.webContents) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.window.maximize()
|
this.window.maximize()
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('window-unmaximize', () => {
|
ipcMain.on('window-unmaximize', event => {
|
||||||
|
if (event.sender !== this.window.webContents) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.window.unmaximize()
|
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()) {
|
if (this.window.isMaximized()) {
|
||||||
this.window.unmaximize()
|
this.window.unmaximize()
|
||||||
} else {
|
} 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()
|
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)
|
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)
|
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)
|
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)
|
this.window.setTitle(title)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
"file-loader": "^0.11.2",
|
"file-loader": "^0.11.2",
|
||||||
"rage-edit-tmp": "^1.1.0",
|
"rage-edit-tmp": "^1.1.0",
|
||||||
"uuid": "^3.3.2",
|
"uuid": "^3.3.2",
|
||||||
"xterm": "^3.6.0"
|
"xterm": "^3.8.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/common": "4.0.1",
|
"@angular/common": "4.0.1",
|
||||||
|
@@ -20,6 +20,18 @@ export class XTermFrontend extends Frontend {
|
|||||||
allowTransparency: true,
|
allowTransparency: true,
|
||||||
enableBold: true,
|
enableBold: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initGlobal = (this.xterm as any)._core._initGlobal.bind((this.xterm as any)._core);
|
||||||
|
(this.xterm as any)._core._initGlobal = () => {
|
||||||
|
this.xterm.textarea.addEventListener('paste', e => {
|
||||||
|
e.clipboardData = null
|
||||||
|
})
|
||||||
|
this.xterm.element.addEventListener('paste', e => {
|
||||||
|
e.clipboardData = null
|
||||||
|
})
|
||||||
|
initGlobal()
|
||||||
|
}
|
||||||
|
|
||||||
this.xterm.on('data', data => {
|
this.xterm.on('data', data => {
|
||||||
this.input.next(data)
|
this.input.next(data)
|
||||||
})
|
})
|
||||||
@@ -34,7 +46,7 @@ export class XTermFrontend extends Frontend {
|
|||||||
attach (host: HTMLElement): void {
|
attach (host: HTMLElement): void {
|
||||||
this.xterm.open(host)
|
this.xterm.open(host)
|
||||||
this.ready.next(null)
|
this.ready.next(null)
|
||||||
this.ready.complete()
|
this.ready.complete();
|
||||||
|
|
||||||
this.resizeHandler = () => (this.xterm as any).fit()
|
this.resizeHandler = () => (this.xterm as any).fit()
|
||||||
window.addEventListener('resize', this.resizeHandler)
|
window.addEventListener('resize', this.resizeHandler)
|
||||||
|
@@ -173,7 +173,7 @@ uuid@^3.3.2:
|
|||||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
|
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
|
||||||
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==
|
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==
|
||||||
|
|
||||||
xterm@^3.6.0:
|
xterm@^3.8.0:
|
||||||
version "3.6.0"
|
version "3.8.0"
|
||||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.6.0.tgz#9b95cd23a338e5842343aec1a104f094c5153e7c"
|
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.8.0.tgz#55d1de518bdc9c9793823f5e4e97d6898972938d"
|
||||||
integrity sha512-D/7/fm7oGzZksLFQdpn1TD63V+T4Ad3LZR2JfZ1QrPZ1yDjKedIKWAZXgzeHQw8S/5HYD08GdkLnjeLm/e6Yog==
|
integrity sha512-rS3HLryuMWbLsv98+jVVSUXCxmoyXPwqwJNC0ad0VSMdXgl65LefPztQVwfurkaF7kM7ZSgM8eJjnJ9kkdoR1w==
|
||||||
|
Reference in New Issue
Block a user