From 9d1d1a02fde0a1561ad6a61e551a144bbeadc45b Mon Sep 17 00:00:00 2001 From: Simon Garrelou Date: Fri, 9 Dec 2022 15:21:04 +0100 Subject: Add play queue page --- src/keybinds.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/keybinds.go (limited to 'src/keybinds.go') diff --git a/src/keybinds.go b/src/keybinds.go new file mode 100644 index 0000000..d69be0b --- /dev/null +++ b/src/keybinds.go @@ -0,0 +1,22 @@ +package src + +import ( + "github.com/gdamore/tcell/v2" + "github.com/rivo/tview" +) + +func (a *app) setupMusicControlKeys(p *tview.Box) { + // Add 'k' and 'l' key bindings + p.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { + if event.Rune() == 'l' { + a.playQueue.Next() + return nil + } + + if event.Rune() == 'k' { + a.playQueue.TogglePause() + return nil + } + return event + }) +} -- cgit v1.2.3