This really should not take 19 minutes to build.

This commit is contained in:
coolnsx
2023-09-03 22:08:51 +05:30
parent b0f598bec3
commit 46a74bdbb5
3 changed files with 25 additions and 31 deletions

View File

@@ -40,12 +40,13 @@
color: #8FBCBB; color: #8FBCBB;
font-size : 24px; font-size : 24px;
font-weight : bold; font-weight : bold;
margin : 10px 0px 0px 0px; margin : 30px 0px 0px 0px;
} }
.artist { .artist {
color: #EBCB8B; color: #EBCB8B;
font-size : 20px; font-size : 20px;
font-weight : normal; font-weight : normal;
margin : 0px 0px -20px 0px;
} }
.btn_play { .btn_play {
color: #A3BE8C; color: #A3BE8C;
@@ -63,6 +64,10 @@
.btn_controls:hover { .btn_controls:hover {
font-size : 50px; font-size : 50px;
} }
.lyrics {
color: #EBCB8B;
margin : -10px 0px 0px 0px;
}
.music_bar { .music_bar {
color: #81A1C1; color: #81A1C1;
background-color: rgba(0,0,0,0.1); background-color: rgba(0,0,0,0.1);

View File

@@ -10,8 +10,7 @@
:reserve (struts :distance "40px" :side "top") :reserve (struts :distance "40px" :side "top")
:windowtype "dock" :windowtype "dock"
:wm-ignore false :wm-ignore false
(clock) (clock))
)
(defwindow time_0 (defwindow time_0
:monitor 0 :monitor 0
@@ -24,13 +23,12 @@
:reserve (struts :distance "40px" :side "top") :reserve (struts :distance "40px" :side "top")
:windowtype "dock" :windowtype "dock"
:wm-ignore false :wm-ignore false
(clock) (clock))
)
(defpoll HOUR :interval "2s" $(date +'%I')) (defpoll HOUR :interval "2s" `date +'%I'`)
(defpoll MIN :interval "2s" $(date +'%M')) (defpoll MIN :interval "2s" `date +'%M'`)
(defpoll MER :interval "2s" $(date +'%p')) (defpoll MER :interval "2s" `date +'%p'`)
(defpoll DAY :interval "5s" $(date +'%A')) (defpoll DAY :interval "5s" `date +'%A'`)
(defwidget clock [] (defwidget clock []
(box :class "genwin" :orientation "h" :spacing 50 :space-evenly false :vexpand "false" :hexpand "false" (box :class "genwin" :orientation "h" :spacing 50 :space-evenly false :vexpand "false" :hexpand "false"
@@ -39,10 +37,7 @@
(label :class "time_min" :valign "end" :wrap "true" :limit-width 25 :text MIN)) (label :class "time_min" :valign "end" :wrap "true" :limit-width 25 :text MIN))
(box :orientation "v" :spacing 0 :space-evenly true (box :orientation "v" :spacing 0 :space-evenly true
(label :class "time_mer" :valign "start" :halign "end" :wrap "true" :limit-width 25 :text MER) (label :class "time_mer" :valign "start" :halign "end" :wrap "true" :limit-width 25 :text MER)
(label :class "time_day" :valign "end" :halign "end" :wrap "true" :limit-width 25 :text DAY) (label :class "time_day" :valign "end" :halign "end" :wrap "true" :limit-width 25 :text DAY))))
)
)
)
;; music ;; music
(defwindow music_0 (defwindow music_0
@@ -56,8 +51,7 @@
:reserve (struts :distance "10px" :side "bottom") :reserve (struts :distance "10px" :side "bottom")
:windowtype "dock" :windowtype "dock"
:wm-ignore true :wm-ignore true
(music) (music))
)
(defwindow music_1 (defwindow music_1
:monitor 1 :monitor 1
@@ -70,32 +64,27 @@
:reserve (struts :distance "10px" :side "bottom") :reserve (struts :distance "10px" :side "bottom")
:windowtype "dock" :windowtype "dock"
:wm-ignore true :wm-ignore true
(music) (music))
)
(defpoll SONG :interval "2s" $(./script song)) (defpoll SONG :interval "2s" `./script song`)
(defpoll ARTIST :interval "2s" $(./script artist)) (defpoll ARTIST :interval "2s" `./script artist`)
(defpoll STATUS :interval "0.4s" $(./script status)) (defpoll STATUS :interval "0.4s" `./script status`)
(defpoll COVER :interval "2s" $(./script cover)) (defpoll COVER :interval "2s" `./script cover`)
(defpoll CURRENT :interval "0.4s" $(./script time)) (defpoll CURRENT :interval "0.4s" `./script time`)
(defpoll LYRICS :interval "0.4s" $(./script lyrics)) (defpoll LYRICS :interval "0.4s" `./script lyrics`)
(defwidget music [] (defwidget music []
(box :class "genwin" :orientation "h" :spacing 50 :space-evenly "false" :vexpand "false" :hexpand "false" (box :class "genwin" :orientation "h" :spacing 50 :space-evenly "false" :vexpand "false" :hexpand "false"
(box :class "box_art" :vexpand "false" :hexpand "false" (box :class "box_art" :vexpand "false" :hexpand "false"
(circular-progress :class "music_bar" :value CURRENT :thickness 10 :clockwise true :start-at 75 (circular-progress :class "music_bar" :value CURRENT :thickness 10 :clockwise true :start-at 75
(image :path COVER :image-height 300 :image-width 300))) (image :path COVER :image-height 300 :image-width 300)))
(box :orientation "v" :spacing 15 :space-evenly "false" :vexpand "false" :hexpand "false" (box :orientation "v" :spacing 20 :space-evenly "false" :vexpand "false" :hexpand "false"
(label :halign "center" :class "song" :wrap "false" :limit-width 30 :text SONG) (label :halign "center" :class "song" :wrap "false" :limit-width 30 :text SONG)
(label :halign "center" :class "artist" :wrap "false" :text ARTIST) (label :halign "center" :class "artist" :wrap "false" :text ARTIST)
(box :orientation "h" :spacing 20 :halign "center" :space-evenly "true" :vexpand "false" :hexpand "false" (box :orientation "h" :spacing 30 :halign "center" :space-evenly "true" :vexpand "false" :hexpand "false"
(button :class "btn_controls" :onclick "./script prev" "玲") (button :class "btn_controls" :onclick "./script prev" "玲")
(button :class "btn_controls" :onclick "./script seek '-1'" "") (button :class "btn_controls" :onclick "./script seek '-1'" "")
(button :class "btn_play" :onclick "./script play_toggle" STATUS) (button :class "btn_play" :onclick "./script play_toggle" STATUS)
(button :class "btn_controls" :onclick "./script seek '1'" "") (button :class "btn_controls" :onclick "./script seek '1'" "")
(button :class "btn_controls" :onclick "./script next" "怜")) (button :class "btn_controls" :onclick "./script next" "怜"))
(label :halign "center" :wrap "true" :class "artist" :text LYRICS) (label :halign "center" :wrap "true" :class "lyrics" :text LYRICS))))
)
)
)

View File

@@ -4,7 +4,7 @@ out=$(printf '{ "command": ["get_property", "pause"]}\n' | socat - /tmp/mpvsocke
case $1 in case $1 in
song) song)
if [ -n "$out" ] && pgrep -f mpvsocket >/dev/null 2>&1;then if [ -n "$out" ] && pgrep -f mpvsocket >/dev/null 2>&1;then
cut -d'>' -f1 < "/tmp/yt-music/current" | cut -d':' -f2 | sed 's|[^-]*$||;s|-$||' cut -d'>' -f1 < "/tmp/yt-music/current" | cut -d':' -f2 | sed 's|[^-]*$||;s|[-| ]$||'
else else
printf "OFFLINE" printf "OFFLINE"
fi fi