Skip to content

Commit

Permalink
adds: ability to toggle song info panel on queue page via i (courte…
Browse files Browse the repository at this point in the history
…sy of @mahmed2000)

Signed-off-by: Sean E. Russell <ser@ser1.net>
  • Loading branch information
xxxserxxx committed Dec 19, 2024
1 parent 4a8428b commit c71e895
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ These controls are accessible from any view:
- `d`/`Delete`: Remove currently selected song from the queue
- `D`: Remove all songs from queue
- `y`: Toggle star on song
- `i`: Toggle song info panel
- `k`: Move song up in queue
- `j`: Move song down in queue
- `s`: Save the queue as a playlist
Expand Down
1 change: 1 addition & 0 deletions help_text.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const helpPageQueue = `
d/DEL remove currently selected song from the queue
D remove all songs from queue
y toggle star on song
i toggle song info panel
k move selected song up in queue
j move selected song down in queue
s save queue as a playlist
Expand Down
16 changes: 11 additions & 5 deletions page_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type QueuePage struct {
queueList *tview.Table
queueData queueData

infoFlex *tview.Flex
songInfo *tview.TextView
coverArt *tview.Image

Expand Down Expand Up @@ -133,7 +134,12 @@ func (ui *Ui) createQueuePage() *QueuePage {
_ = ui.player.Pause()
}
}()

case 'i':
if queuePage.Root.GetItemCount() == 2 {
queuePage.Root.RemoveItem(queuePage.infoFlex)
} else {
queuePage.Root.AddItem(queuePage.infoFlex, 0, 1, false)
}
default:
return event
}
Expand All @@ -154,16 +160,16 @@ func (ui *Ui) createQueuePage() *QueuePage {
queuePage.coverArt = tview.NewImage()
queuePage.coverArt.SetImage(STMPS_LOGO)

infoFlex := tview.NewFlex().SetDirection(tview.FlexRow).
queuePage.infoFlex = tview.NewFlex().SetDirection(tview.FlexRow).
AddItem(queuePage.songInfo, 0, 1, false).
AddItem(queuePage.coverArt, 0, 1, false)
infoFlex.SetBorder(true)
infoFlex.SetTitle(" song info ")
queuePage.infoFlex.SetBorder(true)
queuePage.infoFlex.SetTitle(" song info ")

// flex wrapper
queuePage.Root = tview.NewFlex().SetDirection(tview.FlexColumn).
AddItem(queuePage.queueList, 0, 2, true).
AddItem(infoFlex, 0, 1, false)
AddItem(queuePage.infoFlex, 0, 1, false)

// private data
queuePage.queueData = queueData{
Expand Down

0 comments on commit c71e895

Please sign in to comment.