mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-15 00:50:03 +00:00
fixed #5702 - added hotkeys to jump to settings tabs
This commit is contained in:
parent
f27e1ec62d
commit
136ec1035b
@ -14,6 +14,11 @@ export class SettingsConfigProvider extends ConfigProvider {
|
||||
vault: true,
|
||||
},
|
||||
},
|
||||
hotkeys: {
|
||||
'settings-tab': {
|
||||
__nonStructural: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
platformDefaults = {
|
||||
[Platform.macOS]: {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Inject, Injectable } from '@angular/core'
|
||||
import { HotkeyDescription, HotkeyProvider, TranslateService } from 'tabby-core'
|
||||
import { SettingsTabProvider } from './api'
|
||||
|
||||
/** @hidden */
|
||||
@Injectable()
|
||||
@ -11,9 +12,18 @@ export class SettingsHotkeyProvider extends HotkeyProvider {
|
||||
},
|
||||
]
|
||||
|
||||
constructor (private translate: TranslateService) { super() }
|
||||
constructor (
|
||||
private translate: TranslateService,
|
||||
@Inject(SettingsTabProvider) private settingsProviders: SettingsTabProvider[],
|
||||
) { super() }
|
||||
|
||||
async provide (): Promise<HotkeyDescription[]> {
|
||||
return this.hotkeys
|
||||
return [
|
||||
...this.hotkeys,
|
||||
...this.settingsProviders.map(provider => ({
|
||||
id: `settings-tab.${provider.id}`,
|
||||
name: this.translate.instant('Open settings tab: {tab}', { tab: provider.title }),
|
||||
})),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms'
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { InfiniteScrollModule } from 'ngx-infinite-scroll'
|
||||
|
||||
import TabbyCorePlugin, { ToolbarButtonProvider, HotkeyProvider, ConfigProvider } from 'tabby-core'
|
||||
import TabbyCorePlugin, { ToolbarButtonProvider, HotkeyProvider, ConfigProvider, HotkeysService, AppService } from 'tabby-core'
|
||||
|
||||
import { EditProfileModalComponent } from './components/editProfileModal.component'
|
||||
import { HotkeyInputModalComponent } from './components/hotkeyInputModal.component'
|
||||
@ -74,7 +74,21 @@ import { HotkeySettingsTabProvider, WindowSettingsTabProvider, VaultSettingsTabP
|
||||
],
|
||||
})
|
||||
export default class SettingsModule {
|
||||
constructor (public configSync: ConfigSyncService) { }
|
||||
constructor (
|
||||
public configSync: ConfigSyncService,
|
||||
app: AppService,
|
||||
hotkeys: HotkeysService,
|
||||
) {
|
||||
hotkeys.hotkey$.subscribe(async hotkey => {
|
||||
if (hotkey.startsWith('settings-tab.')) {
|
||||
const id = hotkey.substring(hotkey.indexOf('.') + 1)
|
||||
app.openNewTabRaw({
|
||||
type: SettingsTabComponent,
|
||||
inputs: { activeTab: id },
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export * from './api'
|
||||
|
Loading…
x
Reference in New Issue
Block a user