diff options
Diffstat (limited to 'src/keybinds.go')
-rw-r--r-- | src/keybinds.go | 22 |
1 files changed, 22 insertions, 0 deletions
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 @@ | |||
1 | package src | ||
2 | |||
3 | import ( | ||
4 | "github.com/gdamore/tcell/v2" | ||
5 | "github.com/rivo/tview" | ||
6 | ) | ||
7 | |||
8 | func (a *app) setupMusicControlKeys(p *tview.Box) { | ||
9 | // Add 'k' and 'l' key bindings | ||
10 | p.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { | ||
11 | if event.Rune() == 'l' { | ||
12 | a.playQueue.Next() | ||
13 | return nil | ||
14 | } | ||
15 | |||
16 | if event.Rune() == 'k' { | ||
17 | a.playQueue.TogglePause() | ||
18 | return nil | ||
19 | } | ||
20 | return event | ||
21 | }) | ||
22 | } | ||