(defwidget play_pause_button []
	(eventbox 
		:onclick "playerctl -a ${matches(playing, "Playing") ? "pause && eww update playing_flag=false &" : "play && eww update playing_flag=true &"}"
		(box
            (image
                :image-width 46
                :path {matches(playing, "Playing") ? pause_icon : play_icon} ))))

(defwidget now_playing []
    (eventbox
        :onclick "${player_reveal ? "eww update player_reveal=false" : "eww update player_reveal=true"}"
        :class "playing_image"
            (image 
                :path playing_image
                :image-width 46)))

(defpoll playing :interval "1s" "playerctl status")
(defvar play_icon "widgets/player/play-pause/play-icon.png")
(defvar pause_icon "widgets/player/play-pause/pause-icon.png")
(defvar playing_flag false)
(defpoll playing_image :run-while playing_flag :interval "0.1s" "echo widgets/player/playing-image.jpg")
