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