diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.go | 6 | ||||
-rw-r--r-- | src/footer.go | 17 | ||||
-rw-r--r-- | src/page_artists.go | 3 |
3 files changed, 25 insertions, 1 deletions
@@ -32,7 +32,8 @@ func Run(cfg *Config) { | |||
32 | 32 | ||
33 | a.tv = tview.NewApplication() | 33 | a.tv = tview.NewApplication() |
34 | a.pages = tview.NewPages() | 34 | a.pages = tview.NewPages() |
35 | a.footer = tview.NewTextView() | 35 | a.footer = tview.NewTextView(). |
36 | SetDynamicColors(true) | ||
36 | 37 | ||
37 | a.header = tview.NewTextView(). | 38 | a.header = tview.NewTextView(). |
38 | SetRegions(true). | 39 | SetRegions(true). |
@@ -104,6 +105,7 @@ func (a *app) switchToPage(name string) { | |||
104 | case "artists": | 105 | case "artists": |
105 | a.pages.SwitchToPage("artists") | 106 | a.pages.SwitchToPage("artists") |
106 | a.header.Highlight("artists") | 107 | a.header.Highlight("artists") |
108 | a.tv.SetFocus(a.artistsTree) | ||
107 | case "playlists": | 109 | case "playlists": |
108 | a.pages.SwitchToPage("playlists") | 110 | a.pages.SwitchToPage("playlists") |
109 | a.header.Highlight("playlists") | 111 | a.header.Highlight("playlists") |
@@ -111,4 +113,6 @@ func (a *app) switchToPage(name string) { | |||
111 | a.pages.SwitchToPage("config") | 113 | a.pages.SwitchToPage("config") |
112 | a.header.Highlight("config") | 114 | a.header.Highlight("config") |
113 | } | 115 | } |
116 | |||
117 | a.updateFooter() | ||
114 | } | 118 | } |
diff --git a/src/footer.go b/src/footer.go new file mode 100644 index 0000000..b0494d0 --- /dev/null +++ b/src/footer.go | |||
@@ -0,0 +1,17 @@ | |||
1 | package src | ||
2 | |||
3 | func (a *app) updateFooter() { | ||
4 | switch a.header.GetHighlights()[0] { | ||
5 | case "artists": | ||
6 | switch a.tv.GetFocus() { | ||
7 | case a.artistsTree: | ||
8 | a.footer.SetText("Artists: [blue]Up/Down:[yellow] Move selection [blue]Space:[yellow] Select entry") | ||
9 | case a.songsList: | ||
10 | a.footer.SetText("Songs: [blue]Up/Down:[yellow] Move selection [blue]Space:[yellow] Play") | ||
11 | } | ||
12 | case "playlists": | ||
13 | a.footer.SetText("Come back later!") | ||
14 | case "config": | ||
15 | a.footer.SetText("Configuration page") | ||
16 | } | ||
17 | } | ||
diff --git a/src/page_artists.go b/src/page_artists.go index 23d9a1e..e8ce180 100644 --- a/src/page_artists.go +++ b/src/page_artists.go | |||
@@ -37,6 +37,7 @@ func (a *app) artistsPage() tview.Primitive { | |||
37 | 37 | ||
38 | a.loadAlbumInPanel(sel.id) | 38 | a.loadAlbumInPanel(sel.id) |
39 | a.tv.SetFocus(a.songsList) | 39 | a.tv.SetFocus(a.songsList) |
40 | a.updateFooter() | ||
40 | }) | 41 | }) |
41 | 42 | ||
42 | // Songs list for the selected album | 43 | // Songs list for the selected album |
@@ -47,6 +48,7 @@ func (a *app) artistsPage() tview.Primitive { | |||
47 | a.artistsTree.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { | 48 | a.artistsTree.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { |
48 | if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight { | 49 | if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight { |
49 | a.tv.SetFocus(a.songsList) | 50 | a.tv.SetFocus(a.songsList) |
51 | a.updateFooter() | ||
50 | return nil | 52 | return nil |
51 | } | 53 | } |
52 | return event | 54 | return event |
@@ -55,6 +57,7 @@ func (a *app) artistsPage() tview.Primitive { | |||
55 | a.songsList.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { | 57 | a.songsList.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { |
56 | if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight { | 58 | if event.Key() == tcell.KeyLeft || event.Key() == tcell.KeyRight { |
57 | a.tv.SetFocus(a.artistsTree) | 59 | a.tv.SetFocus(a.artistsTree) |
60 | a.updateFooter() | ||
58 | return nil | 61 | return nil |
59 | } | 62 | } |
60 | return event | 63 | return event |