diff options
author | Simon Garrelou <simon.garrelou@gmail.com> | 2022-12-09 15:21:04 +0100 |
---|---|---|
committer | Simon Garrelou <simon.garrelou@gmail.com> | 2022-12-09 15:21:04 +0100 |
commit | 9d1d1a02fde0a1561ad6a61e551a144bbeadc45b (patch) | |
tree | 7add9eb152c207e0e5cd3aaa6a3cd0b763f3ce4f /src/keybinds.go | |
parent | 84665faeac2e721698dcfdb40d13a3db65e76f80 (diff) | |
download | termsonic-9d1d1a02fde0a1561ad6a61e551a144bbeadc45b.tar.gz termsonic-9d1d1a02fde0a1561ad6a61e551a144bbeadc45b.zip |
Add play queue page
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 | } | ||