41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package tui
|
|
|
|
import (
|
|
"github.com/jroimartin/gocui"
|
|
)
|
|
|
|
func keybindings(g *gocui.Gui) error {
|
|
if err := g.SetKeybinding("input", gocui.KeyEnter, gocui.ModNone, sendMessage); err != nil {
|
|
return err
|
|
}
|
|
if err := g.SetKeybinding("", gocui.KeyCtrlJ, gocui.ModNone, nextContact); err != nil {
|
|
return err
|
|
}
|
|
if err := g.SetKeybinding("", gocui.KeyCtrlK, gocui.ModNone, prevContact); err != nil {
|
|
return err
|
|
}
|
|
if err := g.SetKeybinding("", 'j', gocui.ModNone, scrollChatDown); err != nil {
|
|
return err
|
|
}
|
|
if err := g.SetKeybinding("", 'J', gocui.ModNone, scrollChatDown); err != nil {
|
|
return err
|
|
}
|
|
if err := g.SetKeybinding("", 'k', gocui.ModNone, scrollChatUp); err != nil {
|
|
return err
|
|
}
|
|
if err := g.SetKeybinding("", 'K', gocui.ModNone, scrollChatUp); err != nil {
|
|
return err
|
|
}
|
|
if err := g.SetKeybinding("", gocui.KeyTab, gocui.ModNone, toggleProfileView); err != nil {
|
|
return err
|
|
}
|
|
if err := g.SetKeybinding("", gocui.KeyCtrlQ, gocui.ModNone, quit); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func quit(g *gocui.Gui, v *gocui.View) error {
|
|
return gocui.ErrQuit
|
|
}
|