feat: add default navigation shortcut for guilds list
This commit is contained in:
parent
d815c77c29
commit
1bc81111e8
2 changed files with 14 additions and 4 deletions
|
|
@ -13,6 +13,7 @@ type GeneralConfig struct {
|
|||
}
|
||||
|
||||
type KeybindingsConfig struct {
|
||||
FocusGuildsList []string `json:"focusGuildsList"`
|
||||
FocusChannelsTreeView []string `json:"focusChannelsTreeView"`
|
||||
FocusMessagesTextView []string `json:"focusMessagesTextView"`
|
||||
FocusMessageInputField []string `json:"focusMessageInputField"`
|
||||
|
|
@ -41,9 +42,10 @@ func New() *Config {
|
|||
Notifications: true,
|
||||
},
|
||||
Keybindings: KeybindingsConfig{
|
||||
FocusChannelsTreeView: []string{"Alt+Left"},
|
||||
FocusMessagesTextView: []string{"Alt+Right"},
|
||||
FocusMessageInputField: []string{"Alt+Down"},
|
||||
FocusGuildsList: []string{"Alt+Rune[g]"},
|
||||
FocusChannelsTreeView: []string{"Alt+Rune[t]"},
|
||||
FocusMessagesTextView: []string{"Alt+Rune[m]"},
|
||||
FocusMessageInputField: []string{"Alt+Rune[i]"},
|
||||
|
||||
SelectPreviousMessage: []string{"Up"},
|
||||
SelectNextMessage: []string{"Down"},
|
||||
|
|
|
|||
|
|
@ -13,7 +13,10 @@ import (
|
|||
)
|
||||
|
||||
func onAppInputCapture(app *App, e *tcell.EventKey) *tcell.EventKey {
|
||||
if hasKeybinding(app.Config.Keybindings.FocusChannelsTreeView, e.Name()) {
|
||||
if hasKeybinding(app.Config.Keybindings.FocusGuildsList, e.Name()) {
|
||||
app.SetFocus(app.GuildsList)
|
||||
return nil
|
||||
} else if hasKeybinding(app.Config.Keybindings.FocusChannelsTreeView, e.Name()) {
|
||||
app.SetFocus(app.ChannelsTreeView)
|
||||
return nil
|
||||
} else if hasKeybinding(app.Config.Keybindings.FocusMessagesTextView, e.Name()) {
|
||||
|
|
@ -239,6 +242,11 @@ func onMessagesTextViewInputCapture(app *App, e *tcell.EventKey) *tcell.EventKey
|
|||
}
|
||||
|
||||
func onMessageInputFieldInputCapture(app *App, e *tcell.EventKey) *tcell.EventKey {
|
||||
// The default global navigation shortcut for guilds list is Alt+<rune>.
|
||||
if e.Modifiers() == tcell.ModAlt {
|
||||
return nil
|
||||
}
|
||||
|
||||
switch e.Key() {
|
||||
case tcell.KeyEnter:
|
||||
if app.SelectedChannel == nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue