Support next/previous in audioPlayer

Signed-off-by: AKP <tom@tdpain.net>
This commit is contained in:
akp 2022-11-12 22:33:28 +00:00
parent b65a148b60
commit 5c7c87d911
No known key found for this signature in database
GPG key ID: AA5726202C8879B7

View file

@ -154,10 +154,17 @@ func (g *AudioPlayer) GetNameAndInstance() (string, string) {
}
func (g *AudioPlayer) OnClick(event *i3bar.ClickEvent) bool {
if event.Button != i3bar.LeftMouseButton {
switch event.Button {
case i3bar.LeftMouseButton:
_, _ = runCommand(playerctlExecutable, "play-pause")
case i3bar.MouseWheelScrollUp:
_, _ = runCommand(playerctlExecutable, "next")
case i3bar.MouseWheelScrollDown:
_, _ = runCommand(playerctlExecutable, "previous")
default:
return false
}
_, _ = runCommand(playerctlExecutable, "play-pause")
time.Sleep(time.Millisecond * 50)
return true
}