pointfichiers/bar/eww/music/widget.yuck

74 lines
1.8 KiB
Text

(defvar WAIFU_MODE false) ; Bcz sometimes I listen to Geoxor, so, yeah...
(defvar FALLBACK_COVER "/home/gaspard/Images/Icons/music-disk.png")
(defvar PLAY_STATUS "⏸︎")
(deflisten music_info :initial '{"title": "", "artist": "", "artUrl": "", "status": ""}' "~/.config/eww/scripts/get-music-info")
(defwidget music []
(box
:class "music"
:orientation "h"
:spacing 25
:space-evenly false
(button
:class "art"
:vexpand false
:hexpand false
:style "background-image: url('${WAIFU_MODE ? FALLBACK_COVER : music_info.artUrl ?: FALLBACK_COVER }');"
:onclick `
if [ "$(eww get WAIFU_MODE)" == "true" ]; then
eww update WAIFU_MODE=false
else
eww update WAIFU_MODE=true
fi
`)
(box
:class "player-container"
:orientation "v"
:vexpand true
:space-evenly false
:spacing 25
(label
:class "title"
:limit-width 22
:text "${music_info.title ?: "Not playing"}")
(label
:class "artist"
:limit-width 26
:text "${music_info.artist}")
(box
:orientation "h"
:halign "center"
:valign "center"
:spacing 25
:space-evenly false
:vexpand true
(button
:vexpand false
:onclick "playerctl previous"
:class "previous" "󰒮")
(button
:vexpand false
:onclick "playerctl play-pause"
:class "playpause" "${music_info.status == "Playing" ? "󰏤" : " 󰐊"}")
(button
:vexpand false
:onclick "playerctl next"
:class "next" "󰒭")
)
)
)
)
(defwindow music
:namespace "eww.music"
:monitor 0
:geometry (geometry
:x "456px"
:y "128px"
:anchor "top left")
:stacking "bg"
:focusable false
:exclusive true
(music)
)