2024-03-07 13:37:13 +01:00
|
|
|
(defvar WAIFU_MODE false) ; Bcz sometimes I listen to Geoxor, so, yeah...
|
2024-02-19 15:50:08 +01:00
|
|
|
(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
|
2024-03-07 13:37:13 +01:00
|
|
|
:style "background-image: url('${WAIFU_MODE ? FALLBACK_COVER : music_info.artUrl ?: FALLBACK_COVER }');"
|
2024-02-19 15:50:08 +01:00
|
|
|
:onclick `
|
2024-03-10 19:24:44 +01:00
|
|
|
if [ "$(eww get WAIFU_MODE)" == "true" ]; then
|
|
|
|
eww update WAIFU_MODE=false
|
2024-02-19 15:50:08 +01:00
|
|
|
else
|
2024-03-10 19:24:44 +01:00
|
|
|
eww update WAIFU_MODE=true
|
2024-02-19 15:50:08 +01:00
|
|
|
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"
|
2024-02-19 19:47:59 +01:00
|
|
|
:class "previous" "")
|
2024-02-19 15:50:08 +01:00
|
|
|
(button
|
|
|
|
:vexpand false
|
|
|
|
:onclick "playerctl play-pause"
|
2024-02-19 19:47:59 +01:00
|
|
|
:class "playpause" "${music_info.status == "Playing" ? "" : " "}")
|
2024-02-19 15:50:08 +01:00
|
|
|
(button
|
|
|
|
:vexpand false
|
|
|
|
:onclick "playerctl next"
|
2024-02-19 19:47:59 +01:00
|
|
|
:class "next" "")
|
2024-02-19 15:50:08 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defwindow music
|
|
|
|
:namespace "eww.music"
|
|
|
|
:monitor 0
|
|
|
|
:geometry (geometry
|
2024-03-21 10:14:51 +01:00
|
|
|
:x "456px"
|
|
|
|
:y "128px"
|
2024-02-19 15:50:08 +01:00
|
|
|
:anchor "top left")
|
|
|
|
:stacking "bg"
|
|
|
|
:focusable false
|
|
|
|
:exclusive true
|
|
|
|
(music)
|
|
|
|
)
|