aboutsummaryrefslogtreecommitdiff
path: root/src/keybinds.go
blob: d69be0bd82af3172d6c582092a6545f1a5acb614 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
	})
}