Trigger play/pause when clicking on audioPlayer provider

Signed-off-by: AKP <tom@tdpain.net>
This commit is contained in:
akp 2022-06-01 21:47:11 +01:00
parent c456f98cb0
commit 04e65adead
No known key found for this signature in database
GPG key ID: AA5726202C8879B7

View file

@ -3,6 +3,7 @@ package providers
import (
"fmt"
"strings"
"time"
"github.com/codemicro/bar/internal/i3bar"
)
@ -130,4 +131,10 @@ func (g *AudioPlayer) Block(colors *i3bar.ColorSet) (*i3bar.Block, error) {
func (g *AudioPlayer) GetNameAndInstance() (string, string) {
return g.name, ""
}
func (g *AudioPlayer) OnClick(*i3bar.ClickEvent) bool {
_, _ = runCommand(playerctlExecutable, "play-pause")
time.Sleep(time.Millisecond * 500)
return true
}