111 lines
2.6 KiB
Plaintext
Raw Normal View History

2023-11-22 06:14:03 +01:00
(deflisten radio :initial '{"is_paused":1,"song":{"artist":"","song":"","image600":"https://www.radiorecord.ru/upload/stations_images/record_image600_white_fill.png"},"stations":[]}' "scripts/radio")
(defvar radio_rev false)
(defwidget radio-win []
(box
:class "radio-win"
(radio)))
(defwindow radio
:monitor 0
:geometry (geometry
:x "0%"
:y "0%"
:anchor "bottom right"
:width "200px"
:height "300px")
(radio-win))
(defwidget radio []
(box
:space-evenly false
:orientation "h"
(revealer
:visible radio_rev
:reveal radio_rev
:transition "slideleft"
(radio-selector))
(box
:space-evenly false
:orientation "v"
(box
:class "album_art"
:vexpand "false"
:hexpand "false"
:style "background-size:cover; background-image: url('${radio.song.image600}');")
(box
:space-evenly false
:orientation "v"
(label
:halign "center"
:class "song"
:wrap "true"
:limit-width 25
:text "${radio.song.song}")
(label
:halign "center"
:class "artist"
:wrap "true"
:limit-width 22
:text "${radio.song.artist}")
(box
:space-evenly true
:orientation "h"
:halign "center"
:class "btn_bar"
(button
:class "btn_left"
:onclick "${EWW_CMD} update radio_rev=${!radio_rev}"
(box "󰷐"))
(button
:class "btn_play"
:timeout "1s"
:onclick "scripts/radio toggle"
"${radio.is_paused==1 ? "󰐌" : "󰏥"}")
(button
:class "btn_right"
:onclick ""
(box :visible false "󰔶"))
)
)
)
)
)
(defwidget radio-selector []
(scroll
:active true
:vscroll true
:hscroll false
(box
:class "station_list"
:space-evenly false
:orientation "v"
(for station in {radio.stations}
(button
:class "station_art"
:timeout "1s"
:onclick "scripts/radio start ${station.id}"
:tooltip "${station.title}"
:style "background-size:cover; background-image: url('${station.icon_fill_white}');"
)
)
)
)
)
(defwidget radio-button []
(button
:onclick "${EWW_CMD} open --toggle radio"
(box
:class "module"
:orientation "v"
"󰎆")))