diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-03-23 22:21:42 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-04-30 13:19:53 +1000 |
commit | 2cba98e3fe6c97b319e2a0a24baac93dccfad900 (patch) | |
tree | 82f9ca6eeaedb1a1dc27a125d08ef7c600dd6eb8 /pkg/gui/keybindings.go | |
parent | f8c9ce33c2cdbefac27e6af409a10aa539d4037a (diff) |
move another action into controller
Diffstat (limited to 'pkg/gui/keybindings.go')
-rw-r--r-- | pkg/gui/keybindings.go | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 57251e3bc..2260fcd3d 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -135,21 +135,6 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi Handler: self.scrollDownMain, }, { - ViewName: "", - Key: opts.GetKey(opts.Config.Universal.OptionMenu), - Handler: self.handleCreateOptionsMenu, - OpensMenu: true, - }, - { - ViewName: "", - Key: opts.GetKey(opts.Config.Universal.OptionMenuAlt1), - Modifier: gocui.ModNone, - // we have the description on the alt key and not the main key for legacy reasons - // (the original main key was 'x' but we've reassigned that to other purposes) - Description: self.c.Tr.LcOpenMenu, - Handler: self.handleCreateOptionsMenu, - }, - { ViewName: "files", Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), Handler: self.handleCopySelectedSideContextItemToClipboard, @@ -417,17 +402,21 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi return bindings, mouseKeybindings } -func (gui *Gui) resetKeybindings() error { - gui.g.DeleteAllKeybindings() - - bindings, mouseBindings := gui.GetInitialKeybindings() - - // prepending because we want to give our custom keybindings precedence over default keybindings - customBindings, err := gui.CustomCommandsClient.GetCustomCommandKeybindings() +func (self *Gui) GetInitialKeybindingsWithCustomCommands() ([]*types.Binding, []*gocui.ViewMouseBinding) { + bindings, mouseBindings := self.GetInitialKeybindings() + customBindings, err := self.CustomCommandsClient.GetCustomCommandKeybindings() if err != nil { log.Fatal(err) } + // prepending because we want to give our custom keybindings precedence over default keybindings bindings = append(customBindings, bindings...) + return bindings, mouseBindings +} + +func (gui *Gui) resetKeybindings() error { + gui.g.DeleteAllKeybindings() + + bindings, mouseBindings := gui.GetInitialKeybindingsWithCustomCommands() for _, binding := range bindings { if err := gui.SetKeybinding(binding); err != nil { |