mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-24 19:13:31 +03:00
offer shell selection in the terminal context menu
This commit is contained in:
parent
120e2a2cd5
commit
88bb40f94b
@ -203,7 +203,8 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
this.frontend.focus()
|
||||
}
|
||||
|
||||
buildContextMenu (): Electron.MenuItemConstructorOptions[] {
|
||||
async buildContextMenu (): Promise<Electron.MenuItemConstructorOptions[]> {
|
||||
let shells = await this.terminalService.shells$.toPromise()
|
||||
return [
|
||||
{
|
||||
label: 'New terminal',
|
||||
@ -212,7 +213,16 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
})
|
||||
},
|
||||
{
|
||||
label: 'New from profile',
|
||||
label: 'New with shell',
|
||||
submenu: shells.map(shell => ({
|
||||
label: shell.name,
|
||||
click: () => this.zone.run(async () => {
|
||||
this.terminalService.openTab(shell, await this.session.getWorkingDirectory())
|
||||
}),
|
||||
})),
|
||||
},
|
||||
{
|
||||
label: 'New with profile',
|
||||
submenu: this.config.store.terminal.profiles.length ? this.config.store.terminal.profiles.map(profile => ({
|
||||
label: profile.name,
|
||||
click: () => this.zone.run(() => {
|
||||
@ -223,6 +233,9 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
enabled: false,
|
||||
}],
|
||||
},
|
||||
{
|
||||
type: 'separator',
|
||||
},
|
||||
{
|
||||
label: 'Copy',
|
||||
click: () => {
|
||||
@ -260,11 +273,11 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
this.focused$.subscribe(() => this.frontend.enableResizing = true),
|
||||
this.blurred$.subscribe(() => this.frontend.enableResizing = false),
|
||||
|
||||
this.frontend.mouseEvent$.subscribe(event => {
|
||||
this.frontend.mouseEvent$.subscribe(async event => {
|
||||
if (event.type === 'mousedown') {
|
||||
if (event.which === 3) {
|
||||
if (this.config.store.terminal.rightClick === 'menu') {
|
||||
this.hostApp.popupContextMenu(this.buildContextMenu())
|
||||
this.hostApp.popupContextMenu(await this.buildContextMenu())
|
||||
} else if (this.config.store.terminal.rightClick === 'paste') {
|
||||
this.paste()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user