(defwidget loop_button []
	(eventbox
		:onclick "playerctl -a loop Playlist && eww update loop_playlist_flag=true &"
		:onrightclick "playerctl -a loop Track && eww update loop_track_flag=true &"
		:onmiddleclick "playerctl -a loop None && eww update loop_track_flag=false && eww update loop_playlist_flag=false &"
		(box 
			(image
            :image-width 46
            :path {loop_playlist_flag ? loop_playlist_icon : loop_track_flag ? loop_track_icon : loop_icon}))))

(defvar loop_icon "widgets/player/loop/loop-icon.png")
(defvar loop_track_icon "widgets/player/loop/loop-track-icon.png")
(defvar loop_playlist_icon "widgets/player/loop/loop-playlisy-icon.png")

(defvar loop_track_flag false)
(defvar loop_playlist_flag false)