diff options
author | Simon Garrelou <simon@sixfoisneuf.fr> | 2022-12-06 19:26:34 +0100 |
---|---|---|
committer | Simon Garrelou <simon@sixfoisneuf.fr> | 2022-12-06 19:26:34 +0100 |
commit | f8f5ec9f3b37464094b5264954a60c551304257a (patch) | |
tree | b29526821134004cb9b1dcc074aafa1d9ee4fb53 /src/page_artists.go | |
parent | badc7b254edb837e4338152b4acd34ab5b9b5ddd (diff) | |
download | termsonic-f8f5ec9f3b37464094b5264954a60c551304257a.tar.gz termsonic-f8f5ec9f3b37464094b5264954a60c551304257a.zip |
change focus w/ left-right, quit w/ q, F1-F3
Diffstat (limited to 'src/page_artists.go')
-rw-r--r-- | src/page_artists.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/page_artists.go b/src/page_artists.go index c064785..0e1cc72 100644 --- a/src/page_artists.go +++ b/src/page_artists.go | |||
@@ -18,6 +18,7 @@ func artistsPage(a *app) tview.Primitive { | |||
18 | SetColumns(40, 0). | 18 | SetColumns(40, 0). |
19 | SetBorders(true) | 19 | SetBorders(true) |
20 | 20 | ||
21 | // Artist & album list | ||
21 | root := tview.NewTreeNode("Subsonic server").SetColor(tcell.ColorYellow) | 22 | root := tview.NewTreeNode("Subsonic server").SetColor(tcell.ColorYellow) |
22 | a.artistsTree = tview.NewTreeView(). | 23 | a.artistsTree = tview.NewTreeView(). |
23 | SetRoot(root). | 24 | SetRoot(root). |
@@ -38,9 +39,27 @@ func artistsPage(a *app) tview.Primitive { | |||
38 | a.tv.SetFocus(a.songsList) | 39 | a.tv.SetFocus(a.songsList) |
39 | }) | 40 | }) |
40 | 41 | ||
42 | // Songs list for the selected album | ||
41 | a.songsList = tview.NewList() | 43 | a.songsList = tview.NewList() |
42 | a.songsList.ShowSecondaryText(false) | 44 | a.songsList.ShowSecondaryText(false) |
43 | 45 | ||
46 | // Change the left-right keys to switch between the panels | ||
47 | a.artistsTree.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { | ||
48 | if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight { | ||
49 | a.tv.SetFocus(a.songsList) | ||
50 | return nil | ||
51 | } | ||
52 | return event | ||
53 | }) | ||
54 | |||
55 | a.songsList.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { | ||
56 | if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight { | ||
57 | a.tv.SetFocus(a.artistsTree) | ||
58 | return nil | ||
59 | } | ||
60 | return event | ||
61 | }) | ||
62 | |||
44 | grid.AddItem(a.artistsTree, 0, 0, 1, 1, 0, 0, true) | 63 | grid.AddItem(a.artistsTree, 0, 0, 1, 1, 0, 0, true) |
45 | grid.AddItem(a.songsList, 0, 1, 1, 2, 0, 0, false) | 64 | grid.AddItem(a.songsList, 0, 1, 1, 2, 0, 0, false) |
46 | 65 | ||