Add pause indicator when ShowTextOnPause is enabled

Signed-off-by: AKP <tom@tdpain.net>
This commit is contained in:
akp 2022-05-16 10:39:50 +01:00
parent a3e07530d8
commit d1168c838a
No known key found for this signature in database
GPG key ID: AA5726202C8879B7

View file

@ -9,6 +9,7 @@ import (
const (
musicNoteString = "♪"
pausedIconString = "⏸️"
playerctlExecutable = "playerctl"
playerStatusStopped = "Stopped"
@ -101,8 +102,17 @@ func (g *AudioPlayer) Block(colors *i3bar.ColorSet) (*i3bar.Block, error) {
b.ShortText = musicNoteString
if info.Status == playerStatusPlaying || (info.Status == playerStatusPaused && g.ShowTextOnPause) {
b.ShortText += " " + g.TrimString(info.Track)
b.FullText += " " + g.TrimString(fmt.Sprintf("%s - %s", info.Track, info.Artist))
b.ShortText += " "
b.FullText += " "
if info.Status == playerStatusPaused {
b.ShortText += pausedIconString + " "
b.FullText += pausedIconString + " "
}
b.ShortText += g.TrimString(info.Track)
b.FullText += g.TrimString(fmt.Sprintf("%s - %s", info.Track, info.Artist))
}
return b, nil