aboutsummaryrefslogtreecommitdiff
path: root/src/page_artists.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/page_artists.go')
-rw-r--r--src/page_artists.go19
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