dotfiles/home/r0r5chach/.config/eww/widgets/player/play-pause/play-pause.yuck

22 lines
973 B
Plaintext
Raw Normal View History

2023-07-11 04:43:17 +00:00
(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
2023-10-06 16:10:14 +00:00
:path {playing_flag ? playing_image : "widgets/player/play-pause/stop-icon.png"}
2023-07-11 04:43:17 +00:00
: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)
2023-10-06 16:10:14 +00:00
(defpoll playing_image :run-while playing_flag :interval "1s" "printf '%s' widgets/player/playing-image.jpg")