dotfiles/dot_config/eww/playerctl/playerctl.yuck
2022-09-07 15:20:03 +05:30

61 lines
2.4 KiB
Plaintext

(defpoll ALBUMART :interval "5s" "scripts/playerctl.sh image")
(defpoll ALBUM :interval "5s" "scripts/playerctl.sh album")
(defpoll PLAYPAUSE :interval "1s" "scripts/playerctl.sh status")
(defpoll ARTIST :interval "5s" "scripts/playerctl.sh artist")
(defpoll TITLE :interval "5s" "scripts/playerctl.sh title")
(defwindow playerctl
:monitor 0
:geometry (geometry :x "10px"
:y "10px"
:width "400"
:height "550"
:anchor "top right")
:stacking "overlay"
:windowtype "normal"
:wm-ignore true
(player))
(defwidget player []
(box :orientation "v"
:halign "center"
:space-evenly true
(image :path {"${ALBUMART}" == "Offline" ? "assets/images/albumart.jpg" : "${ALBUMART}"}
:class "image-album"
:image-width 256)
(box :orientation "vertical"
:space-evenly false
(box :orientation "horizontal"
:halign "center"
:space-evenly false
(button :onclick "playerctl --player playerctld previous"
:class "btn-previous"
(label :text " 玲"
:class "label-media label-previous"))
(button :onclick "playerctl --player playerctld play-pause"
:class "btn-play-pause"
(label :text {"${PLAYPAUSE}" == "Playing" ? "" : ""}
:class "label-media label-play-pause"))
(button :onclick "playerctl --player playerctld next"
:class "btn-next"
(label :text "怜 "
:class "label-media label-next")))
(label :text {"${ARTIST}" == "None" ? "" : "${ARTIST}"}
:tooltip {"${ARTIST}" == "None" ? "" : "${ARTIST}"}
:class "label-artist"
:halign "center"
:limit-width 15
:hexpand true)
(label :text {"${ALBUM}" == "None" ? "" : "${ALBUM}"}
:tooltip {"${ALBUM}" == "None" ? "" : "${ALBUM}"}
:class "label-album"
:halign "center"
:limit-width 15
:hexpand true)
(label :text "${TITLE}"
:tooltip {"${TITLE}" == "None" ? "" : "${TITLE}"}
:class "label-title"
:halign "center"
:limit-width 15
:hexpand true))))