Skip to content

Commit

Permalink
fixed #7481 - broadcast not available on SSH tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Nov 17, 2022
1 parent ac9595b commit d26ce6c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
21 changes: 1 addition & 20 deletions tabby-local/src/tabContextMenu.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -66,7 +65,6 @@ export class NewTabContextMenu extends TabContextMenuItemProvider {
private terminalService: TerminalService,
private uac: UACService,
private translate: TranslateService,
private multifocus: MultifocusService,
) {
super()
}
Expand Down Expand Up @@ -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
}
}
31 changes: 25 additions & 6 deletions tabby-terminal/src/tabContextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
}
}

Expand Down

0 comments on commit d26ce6c

Please sign in to comment.