Radio
This commit is contained in:
@@ -82,23 +82,15 @@
|
||||
(defwidget quick-section []
|
||||
(box :orientation "v" :space-evenly false :class "sys-section"
|
||||
(section-header :title "Quick Actions" :accent "quick-accent")
|
||||
(box :orientation "h" :homogeneous true :class "quick-grid"
|
||||
(quick-btn
|
||||
:icon "" :label "Wallpaper"
|
||||
:onclick "scripts/wallpaper"
|
||||
:active false)
|
||||
(quick-btn
|
||||
:icon "" :label "Power Save"
|
||||
:onclick "eww update power-save=$(scripts/power-save)"
|
||||
:active {power-save})
|
||||
(quick-btn
|
||||
:icon "" :label "Night Light"
|
||||
:onclick "eww update night-light=$(scripts/nightlight)"
|
||||
:active {night-light})
|
||||
(quick-btn
|
||||
:icon "" :label "Screenshot"
|
||||
:onclick "scripts/screenshot"
|
||||
:active false))))
|
||||
(box :orientation "v" :space-evenly false :class "quick-grid" :spacing 4
|
||||
(box :orientation "h" :space-evenly true
|
||||
(quick-btn :icon "" :label "Wallpaper" :onclick "scripts/wallpaper" :active false)
|
||||
(quick-btn :icon "" :label "Power Save" :onclick "eww update power-save=$(scripts/power-save)" :active {power-save})
|
||||
(quick-btn :icon "" :label "Night Light" :onclick "eww update night-light=$(scripts/nightlight)" :active {night-light}))
|
||||
(box :orientation "h" :space-evenly true
|
||||
(quick-btn :icon "" :label "Screenshot" :onclick "scripts/screenshot" :active false)
|
||||
(quick-btn :icon "" :label "Lock" :onclick "swaylock" :active false)
|
||||
(quick-btn :icon "" :label "Color Pick" :onclick "hyprpicker -a" :active false)))))
|
||||
|
||||
; --- Brightness ---
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
(revealer :reveal {active-panel == "net"} :transition "slidedown" :duration 120
|
||||
(net-win))
|
||||
(revealer :reveal {active-panel == "clock"} :transition "slidedown" :duration 120
|
||||
(clock-win))))
|
||||
(clock-win))
|
||||
(revealer :reveal {active-panel == "radio"} :transition "slidedown" :duration 120
|
||||
(radio-win))))
|
||||
|
||||
(defwindow popup
|
||||
:monitor 0
|
||||
|
||||
@@ -1,111 +1,82 @@
|
||||
(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)
|
||||
|
||||
(defwindow radio
|
||||
:monitor 0
|
||||
:geometry (geometry
|
||||
:x "0%"
|
||||
:y "0%"
|
||||
:anchor "bottom right"
|
||||
:width "0px"
|
||||
:height "0px")
|
||||
(window (radio-win)))
|
||||
(deflisten radio
|
||||
:initial '{"is_paused":1,"song":{"artist":"","song":"","image600":""},"radio":0,"stations":[],"media":{"player":"","status":"Stopped","artist":"","title":"","art":""}}'
|
||||
"scripts/radio")
|
||||
(defvar radio-vol 80)
|
||||
(defvar radio-muted false)
|
||||
|
||||
(defwidget radio-win []
|
||||
(box :class "sys-win" :orientation "v" :space-evenly false
|
||||
|
||||
(defwidget radio-win []
|
||||
(box
|
||||
:space-evenly false
|
||||
:orientation "h"
|
||||
(revealer
|
||||
:visible radio_rev
|
||||
:reveal radio_rev
|
||||
:transition "slideleft"
|
||||
(radio-selector))
|
||||
(box
|
||||
:space-evenly false
|
||||
:orientation "v"
|
||||
; --- Now Playing ---
|
||||
(box :orientation "v" :space-evenly false :class "sys-section"
|
||||
(section-header :title "Media" :accent "radio-accent")
|
||||
(box :orientation "h" :space-evenly false :valign "center" :spacing 10 :class "radio-now-playing"
|
||||
(box :class "radio-art"
|
||||
:style "background-image: url('${radio.is_paused == 0 ? radio.song.image600 : (radio.media.status != 'Stopped' ? radio.media.art : radio.song.image600)}'); background-size: cover; background-position: center;"
|
||||
(label :class "radio-art-icon" :halign "center" :valign "center"
|
||||
:visible {radio.is_paused == 0
|
||||
? radio.song.image600 == ""
|
||||
: (radio.media.status != "Stopped"
|
||||
? radio.media.art == ""
|
||||
: radio.song.image600 == "")}
|
||||
:text ""))
|
||||
(box :orientation "v" :space-evenly false :hexpand true :valign "center"
|
||||
(label :class "radio-song" :halign "start" :wrap true :limit-width 20
|
||||
:text {radio.is_paused == 0
|
||||
? (radio.song.song != "" ? radio.song.song : "Tuning in...")
|
||||
: (radio.media.status != "Stopped"
|
||||
? (radio.media.title != "" ? radio.media.title : "Playing")
|
||||
: (radio.song.song != "" ? radio.song.song : "Nothing playing"))})
|
||||
(label :class "radio-artist" :halign "start" :wrap true :limit-width 22
|
||||
:text {radio.is_paused == 0
|
||||
? radio.song.artist
|
||||
: (radio.media.status != "Stopped"
|
||||
? (radio.media.artist != "" ? radio.media.artist : radio.media.player)
|
||||
: "")})))
|
||||
|
||||
(box
|
||||
:class "album_art"
|
||||
:style "background-size:cover; background-image: url('${radio.song.image600?:'https://www.radiorecord.ru/upload/stations_images/record_image600_white_fill.png'}');")
|
||||
(box
|
||||
:space-evenly false
|
||||
:orientation "v"
|
||||
(label
|
||||
:halign "center"
|
||||
:class "song"
|
||||
:wrap "true"
|
||||
:limit-width 18
|
||||
: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"
|
||||
; Controls - hidden only in placeholder state
|
||||
(box :visible {radio.is_paused == 0 || radio.radio > 0 || radio.media.status != "Stopped"}
|
||||
:orientation "v" :space-evenly false :class "radio-controls"
|
||||
(box :orientation "h" :space-evenly true :halign "center"
|
||||
(button :visible {radio.is_paused == 1 && radio.media.status != "Stopped"}
|
||||
:class "radio-ctrl-btn" :timeout "2s" :onclick "playerctl previous"
|
||||
(label :text ""))
|
||||
(button :class "radio-ctrl-btn" :timeout "2s"
|
||||
:onclick {radio.is_paused == 1 && radio.media.status != "Stopped" ? "playerctl play-pause" : "scripts/radio toggle"}
|
||||
(label :text {radio.is_paused == 0 ? "" : (radio.media.status == "Playing" ? "" : "")}))
|
||||
(button :visible {radio.is_paused == 1 && radio.media.status != "Stopped"}
|
||||
:class "radio-ctrl-btn" :timeout "2s" :onclick "playerctl next"
|
||||
(label :text "")))
|
||||
(vol-row
|
||||
:icon ""
|
||||
:value {radio-vol}
|
||||
:onchange "scripts/radio vol {}"
|
||||
:onclick "scripts/radio mute"
|
||||
:muted {radio-muted})))
|
||||
|
||||
(button
|
||||
:class "btn_left"
|
||||
:onclick "${EWW_CMD} update radio_rev=${!radio_rev}"
|
||||
(box ""))
|
||||
(box :class "section-sep")
|
||||
|
||||
(button
|
||||
:class "btn_play"
|
||||
:timeout "2s"
|
||||
: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}
|
||||
; --- Stations ---
|
||||
(box :orientation "v" :space-evenly false :class "sys-section"
|
||||
(section-header :title "Radio Stations" :accent "radio-accent")
|
||||
(scroll :vscroll true :hscroll false :height 130
|
||||
(box :class "station-list" :space-evenly false :orientation "v"
|
||||
(for station in {radio.stations}
|
||||
(button
|
||||
:class "station_art ${(radio.radio == station.id)?'station_sel':''}"
|
||||
:timeout "2s"
|
||||
:onclick "scripts/radio start ${station.id}"
|
||||
:tooltip "${station.title}"
|
||||
:style "background-size:cover; background-image: url('${station.icon_fill_white}');"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:class "station-row ${radio.radio == station.id ? 'station-row-active' : ''}"
|
||||
:timeout "2s"
|
||||
:onclick "scripts/radio start ${station.id}"
|
||||
:tooltip {station.title}
|
||||
(box :orientation "h" :space-evenly false :valign "center"
|
||||
(box :class "station-icon"
|
||||
:style "background-image: url('${station.icon_fill_white}'); background-size: contain; background-position: center;")
|
||||
(label :class "station-name" :text {station.title}
|
||||
:hexpand true :halign "start" :limit-width 16)))))))))
|
||||
|
||||
(defwidget radio-mod []
|
||||
(module
|
||||
(box
|
||||
:orientation "v"
|
||||
(button
|
||||
:onclick "(sleep 0.1 && eww-open-on-current-screen radio --toggle --no-daemonize)"
|
||||
(label
|
||||
:show-truncated false
|
||||
:class "icon-text"
|
||||
:text "")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(eventbox
|
||||
:onclick "(sleep 0.1 && scripts/panel-toggle radio)"
|
||||
(box :orientation "v"
|
||||
(label :show-truncated false :class "icon-text" :text "")))))
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
(box :orientation "v" :space-evenly false :class "sys-section"
|
||||
(section-header :title "GPU" :accent "gpu-accent")
|
||||
(box :orientation "h" :space-evenly true
|
||||
; GFX — outer: activity%, inner: clock% of range
|
||||
; GFX - outer: activity%, inner: clock% of range
|
||||
(box :orientation "v" :space-evenly false :halign "center"
|
||||
(overlay
|
||||
(circular-progress :width 68 :height 68
|
||||
@@ -84,7 +84,7 @@
|
||||
(box :halign "center" :valign "center"
|
||||
(label :class "gpu-ring-value" :text "${round(gpu.gfx_pct, 0)}%")))
|
||||
(label :class "gpu-ring-label" :text "GFX" :halign "center"))
|
||||
; Memory — outer: activity%, inner: memory clock% of range
|
||||
; Memory - outer: activity%, inner: memory clock% of range
|
||||
(box :orientation "v" :space-evenly false :halign "center"
|
||||
(overlay
|
||||
(circular-progress :width 68 :height 68
|
||||
@@ -99,7 +99,7 @@
|
||||
(box :halign "center" :valign "center"
|
||||
(label :class "gpu-ring-value" :text "${round(gpu.mem_pct, 0)}%")))
|
||||
(label :class "gpu-ring-label" :text "Mem" :halign "center"))
|
||||
; Media — outer: activity%, inner: video clock% of GPU clock max
|
||||
; Media - outer: activity%, inner: video clock% of GPU clock max
|
||||
(box :orientation "v" :space-evenly false :halign "center"
|
||||
(overlay
|
||||
(circular-progress :width 68 :height 68
|
||||
|
||||
Reference in New Issue
Block a user