mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-09 22:10:09 +00:00
37 lines
1008 B
TypeScript
37 lines
1008 B
TypeScript
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
import { Injectable } from '@angular/core'
|
|
import { HotkeysService, ToolbarButtonProvider, ToolbarButton } from 'terminus-core'
|
|
import { SSHService } from './services/ssh.service'
|
|
|
|
/** @hidden */
|
|
@Injectable()
|
|
export class ButtonProvider extends ToolbarButtonProvider {
|
|
constructor (
|
|
hotkeys: HotkeysService,
|
|
private ssh: SSHService,
|
|
) {
|
|
super()
|
|
hotkeys.matchedHotkey.subscribe(async (hotkey: string) => {
|
|
if (hotkey === 'ssh') {
|
|
this.activate()
|
|
}
|
|
})
|
|
}
|
|
|
|
activate () {
|
|
this.ssh.showConnectionSelector()
|
|
}
|
|
|
|
provide (): ToolbarButton[] {
|
|
return [{
|
|
icon: require('./icons/globe.svg'),
|
|
weight: 5,
|
|
title: 'SSH connections',
|
|
touchBarNSImage: 'NSTouchBarOpenInBrowserTemplate',
|
|
click: async () => {
|
|
this.activate()
|
|
},
|
|
}]
|
|
}
|
|
}
|