ignore player-next/prev if only one player avavilable
stops the tooltip from flickering.
This commit is contained in:
parent
8fb822aa91
commit
3918d2f30e
10
main.go
10
main.go
@ -418,21 +418,27 @@ func main() {
|
|||||||
}
|
}
|
||||||
command := string(buf[0:nr])
|
command := string(buf[0:nr])
|
||||||
if command == "player-next" {
|
if command == "player-next" {
|
||||||
if players.current < uint(len(players.list)-1) {
|
length := len(players.list)
|
||||||
|
if length != 1 {
|
||||||
|
if players.current < uint(length-1) {
|
||||||
players.current += 1
|
players.current += 1
|
||||||
} else {
|
} else {
|
||||||
players.current = 0
|
players.current = 0
|
||||||
}
|
}
|
||||||
players.Refresh()
|
players.Refresh()
|
||||||
fmt.Println(players.JSON())
|
fmt.Println(players.JSON())
|
||||||
|
}
|
||||||
} else if command == "player-prev" {
|
} else if command == "player-prev" {
|
||||||
|
length := len(players.list)
|
||||||
|
if length != 1 {
|
||||||
if players.current != 0 {
|
if players.current != 0 {
|
||||||
players.current -= 1
|
players.current -= 1
|
||||||
} else {
|
} else {
|
||||||
players.current = uint(len(players.list) - 1)
|
players.current = uint(length - 1)
|
||||||
}
|
}
|
||||||
players.Refresh()
|
players.Refresh()
|
||||||
fmt.Println(players.JSON())
|
fmt.Println(players.JSON())
|
||||||
|
}
|
||||||
} else if command == "next" {
|
} else if command == "next" {
|
||||||
players.Next()
|
players.Next()
|
||||||
} else if command == "prev" {
|
} else if command == "prev" {
|
||||||
|
BIN
waybar-mpris
BIN
waybar-mpris
Binary file not shown.
Loading…
Reference in New Issue
Block a user