mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-23 10:32:29 +03:00
faster tab creation
This commit is contained in:
parent
6fa5ab5eb2
commit
6bc2d18f3c
@ -1,5 +1,5 @@
|
||||
import { Subject, Observable } from 'rxjs'
|
||||
import { BrowserWindow, app, ipcMain, Rectangle } from 'electron'
|
||||
import { BrowserWindow, app, ipcMain, Rectangle, Menu } from 'electron'
|
||||
import ElectronConfig = require('electron-config')
|
||||
import * as yaml from 'js-yaml'
|
||||
import * as fs from 'fs'
|
||||
@ -188,6 +188,10 @@ export class Window {
|
||||
ipcMain.on('window-set-title', (_event, title) => {
|
||||
this.window.setTitle(title)
|
||||
})
|
||||
|
||||
ipcMain.on('window-popup-context-menu', (_event, menuDefinition) => {
|
||||
Menu.buildFromTemplate(menuDefinition).popup({ window: this.window })
|
||||
})
|
||||
}
|
||||
|
||||
private destroy () {
|
||||
|
@ -155,6 +155,14 @@ export class HostAppService {
|
||||
this.electron.ipcRenderer.send('window-set-title', title)
|
||||
}
|
||||
|
||||
setTouchBar (touchBar: Electron.TouchBar) {
|
||||
this.getWindow().setTouchBar(touchBar)
|
||||
}
|
||||
|
||||
popupContextMenu (menuDefinition: Electron.MenuItemConstructorOptions[]) {
|
||||
this.electron.ipcRenderer.send('window-popup-context-menu', menuDefinition)
|
||||
}
|
||||
|
||||
broadcastConfigChange () {
|
||||
this.electron.ipcRenderer.send('app:config-change')
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ export class TouchbarService {
|
||||
...buttons.map(button => this.getButton(button))
|
||||
]
|
||||
})
|
||||
this.hostApp.getWindow().setTouchBar(touchBar)
|
||||
this.hostApp.setTouchBar(touchBar)
|
||||
}
|
||||
|
||||
private getButton (button: IToolbarButton): Electron.TouchBarButton {
|
||||
|
@ -199,7 +199,7 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
}
|
||||
})
|
||||
|
||||
this.contextMenu = this.electron.remote.Menu.buildFromTemplate([
|
||||
this.contextMenu = [
|
||||
{
|
||||
label: 'New terminal',
|
||||
click: () => {
|
||||
@ -227,7 +227,7 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
})
|
||||
}
|
||||
},
|
||||
])
|
||||
]
|
||||
}
|
||||
|
||||
detachTermContainerHandlers () {
|
||||
@ -249,9 +249,7 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
if (event.type === 'mousedown') {
|
||||
if (event.which === 3) {
|
||||
if (this.config.store.terminal.rightClick === 'menu') {
|
||||
this.contextMenu.popup({
|
||||
async: true,
|
||||
})
|
||||
this.hostApp.popupContextMenu(this.contextMenu)
|
||||
} else if (this.config.store.terminal.rightClick === 'paste') {
|
||||
this.paste()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user