mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-07 21:10:00 +00:00
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { Injectable } from '@angular/core'
|
|
import { DomSanitizer } from '@angular/platform-browser'
|
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
|
import { HotkeysService, ToolbarButtonProvider, IToolbarButton } from 'terminus-core'
|
|
import { SSHModalComponent } from './components/sshModal.component'
|
|
|
|
@Injectable()
|
|
export class ButtonProvider extends ToolbarButtonProvider {
|
|
constructor (
|
|
private ngbModal: NgbModal,
|
|
private domSanitizer: DomSanitizer,
|
|
hotkeys: HotkeysService,
|
|
) {
|
|
super()
|
|
hotkeys.matchedHotkey.subscribe(async (hotkey) => {
|
|
if (hotkey === 'ssh') {
|
|
this.activate()
|
|
}
|
|
})
|
|
}
|
|
|
|
activate () {
|
|
this.ngbModal.open(SSHModalComponent)
|
|
}
|
|
|
|
provide (): IToolbarButton[] {
|
|
return [{
|
|
icon: this.domSanitizer.bypassSecurityTrustHtml(require('./icons/globe.svg')),
|
|
weight: 5,
|
|
title: 'SSH connections',
|
|
touchBarTitle: 'SSH',
|
|
click: async () => {
|
|
this.activate()
|
|
}
|
|
}]
|
|
}
|
|
}
|