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