mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-20 02:18:01 +00:00
hotkeys for specific shells
This commit is contained in:
@@ -244,8 +244,8 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
|
||||
td {{hotkey.id}}
|
||||
td
|
||||
multi-hotkey-input(
|
||||
[(model)]='config.store.hotkeys[hotkey.id]',
|
||||
(modelChange)='config.save(); docking.dock()'
|
||||
[model]='getHotkey(hotkey.id)',
|
||||
(modelChange)='setHotkey(hotkey.id, $event); config.save(); docking.dock()'
|
||||
)
|
||||
|
||||
ngb-tab(*ngFor='let provider of settingsProviders', [id]='provider.id')
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import * as yaml from 'js-yaml'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { Component, Inject, Input } from '@angular/core'
|
||||
import { HotkeysService } from 'terminus-core'
|
||||
import {
|
||||
ElectronService,
|
||||
DockingService,
|
||||
@@ -43,12 +44,12 @@ export class SettingsTabComponent extends BaseTabComponent {
|
||||
public hostApp: HostAppService,
|
||||
public homeBase: HomeBaseService,
|
||||
public shellIntegration: ShellIntegrationService,
|
||||
hotkeys: HotkeysService,
|
||||
@Inject(HotkeyProvider) hotkeyProviders: HotkeyProvider[],
|
||||
@Inject(SettingsTabProvider) public settingsProviders: SettingsTabProvider[],
|
||||
@Inject(Theme) public themes: Theme[],
|
||||
) {
|
||||
super()
|
||||
this.hotkeyDescriptions = config.enabledServices(hotkeyProviders).map(x => x.hotkeys).reduce((a, b) => a.concat(b))
|
||||
this.setTitle('Settings')
|
||||
this.screens = this.docking.getScreens()
|
||||
this.settingsProviders = config.enabledServices(this.settingsProviders)
|
||||
@@ -59,6 +60,10 @@ export class SettingsTabComponent extends BaseTabComponent {
|
||||
this.configSubscription = config.changed$.subscribe(() => {
|
||||
this.configFile = config.readRaw()
|
||||
})
|
||||
|
||||
hotkeys.getHotkeyDescriptions().then(descriptions => {
|
||||
this.hotkeyDescriptions = descriptions
|
||||
})
|
||||
}
|
||||
|
||||
async ngOnInit () {
|
||||
@@ -98,4 +103,22 @@ export class SettingsTabComponent extends BaseTabComponent {
|
||||
await this.shellIntegration.install()
|
||||
this.isShellIntegrationInstalled = true
|
||||
}
|
||||
|
||||
getHotkey (id: string) {
|
||||
let ptr = this.config.store.hotkeys
|
||||
for (let token of id.split(/\./g)) {
|
||||
ptr = ptr[token]
|
||||
}
|
||||
return ptr
|
||||
}
|
||||
|
||||
setHotkey (id: string, value) {
|
||||
let ptr = this.config.store
|
||||
let prop = 'hotkeys'
|
||||
for (let token of id.split(/\./g)) {
|
||||
ptr = ptr[prop]
|
||||
prop = token
|
||||
}
|
||||
ptr[prop] = value
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user