tabby/terminus-terminal/src/hotkeys.ts

78 lines
1.8 KiB
TypeScript
Raw Normal View History

import { Injectable } from '@angular/core'
import { IHotkeyDescription, HotkeyProvider } from 'terminus-core'
2018-10-12 15:59:22 +00:00
import { TerminalService } from './services/terminal.service'
@Injectable()
export class TerminalHotkeyProvider extends HotkeyProvider {
hotkeys: IHotkeyDescription[] = [
2017-07-05 16:46:16 +00:00
{
id: 'copy',
name: 'Copy to clipboard',
},
{
id: 'paste',
name: 'Paste from clipboard',
},
{
id: 'home',
name: 'Beginning of the line',
},
{
id: 'end',
name: 'End of the line',
},
{
id: 'previous-word',
name: 'Jump to previous word',
},
{
id: 'next-word',
name: 'Jump to next word',
},
{
id: 'delete-previous-word',
name: 'Delete previous word',
},
{
id: 'delete-next-word',
name: 'Delete next word',
},
{
id: 'clear',
name: 'Clear terminal',
},
{
id: 'zoom-in',
name: 'Zoom in',
},
{
id: 'zoom-out',
name: 'Zoom out',
},
{
id: 'reset-zoom',
name: 'Reset zoom',
},
{
id: 'new-tab',
name: 'New tab',
},
2018-04-01 17:51:04 +00:00
{
id: 'ctrl-c',
name: 'Intelligent Ctrl-C (copy/abort)',
},
]
2018-10-12 15:59:22 +00:00
constructor (
private terminal: TerminalService,
) { super() }
async provide (): Promise<IHotkeyDescription[]> {
let shells = await this.terminal.shells$.toPromise()
return this.hotkeys.concat(shells.map(shell => ({
id: `shell.${shell.id}`,
name: `New tab: ${shell.name}`
})))
}
}