fixed #7481 - broadcast not available on SSH tabs

This commit is contained in:
Eugene Pankov 2022-11-17 10:56:22 +01:00
parent ac9595b06a
commit d26ce6c316
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
2 changed files with 26 additions and 26 deletions

View File

@ -1,7 +1,6 @@
import { Injectable } from '@angular/core'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { ConfigService, BaseTabComponent, TabContextMenuItemProvider, SplitTabComponent, NotificationsService, MenuItemOptions, ProfilesService, PromptModalComponent, TranslateService } from 'tabby-core'
import { MultifocusService } from 'tabby-terminal'
import { ConfigService, BaseTabComponent, TabContextMenuItemProvider, NotificationsService, MenuItemOptions, ProfilesService, PromptModalComponent, TranslateService } from 'tabby-core'
import { TerminalTabComponent } from './components/terminalTab.component'
import { UACService } from './services/uac.service'
import { TerminalService } from './services/terminal.service'
@ -66,7 +65,6 @@ export class NewTabContextMenu extends TabContextMenuItemProvider {
private terminalService: TerminalService,
private uac: UACService,
private translate: TranslateService,
private multifocus: MultifocusService,
) {
super()
}
@ -133,23 +131,6 @@ export class NewTabContextMenu extends TabContextMenuItemProvider {
})
}
if (tab instanceof TerminalTabComponent && tab.parent instanceof SplitTabComponent) {
items.push({
label: this.translate.instant('Focus all tabs'),
click: () => {
this.multifocus.focusAllTabs()
},
})
if (tab.parent.getAllTabs().length > 1) {
items.push({
label: this.translate.instant('Focus all panes'),
click: () => {
this.multifocus.focusAllPanes()
},
})
}
}
return items
}
}

View File

@ -2,6 +2,7 @@ import { Injectable, Optional, Inject } from '@angular/core'
import { BaseTabComponent, TabContextMenuItemProvider, NotificationsService, MenuItemOptions, TranslateService } from 'tabby-core'
import { BaseTerminalTabComponent } from './api/baseTerminalTab.component'
import { TerminalContextMenuItemProvider } from './api/contextMenuProvider'
import { MultifocusService } from './services/multifocus.service'
/** @hidden */
@Injectable()
@ -45,24 +46,42 @@ export class CopyPasteContextMenu extends TabContextMenuItemProvider {
export class MiscContextMenu extends TabContextMenuItemProvider {
weight = 1
constructor (private translate: TranslateService) { super() }
constructor (
private translate: TranslateService,
private multifocus: MultifocusService,
) { super() }
async getItems (tab: BaseTabComponent): Promise<MenuItemOptions[]> {
const items: MenuItemOptions[] = []
if (tab instanceof BaseTerminalTabComponent && tab.enableToolbar && !tab.pinToolbar) {
return [{
items.push({
label: this.translate.instant('Show toolbar'),
click: () => {
tab.pinToolbar = true
},
}]
})
}
if (tab instanceof BaseTerminalTabComponent && tab.session?.supportsWorkingDirectory()) {
return [{
items.push({
label: this.translate.instant('Copy current path'),
click: () => tab.copyCurrentPath(),
}]
})
}
return []
items.push({
label: this.translate.instant('Focus all tabs'),
click: () => {
this.multifocus.focusAllTabs()
},
})
if (tab.parent.getAllTabs().length > 1) {
items.push({
label: this.translate.instant('Focus all panes'),
click: () => {
this.multifocus.focusAllPanes()
},
})
}
return items
}
}