mirror of
https://github.com/CoolnsX/hyprdots.git
synced 2025-12-20 07:15:23 +05:30
Can someone review this commit, please ?
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
color: #8FBCBB;
|
||||
font-size : 24px;
|
||||
font-weight : bold;
|
||||
margin : 30px 0px 0px 0px;
|
||||
margin : 20px 0px 0px 0px;
|
||||
}
|
||||
.artist {
|
||||
color: #EBCB8B;
|
||||
@@ -66,7 +66,7 @@
|
||||
}
|
||||
.lyrics {
|
||||
color: #EBCB8B;
|
||||
margin : -10px 0px 0px 0px;
|
||||
margin : -20px 0px 0px 0px;
|
||||
}
|
||||
.music_bar {
|
||||
color: #81A1C1;
|
||||
|
||||
39
eww/eww.yuck
39
eww/eww.yuck
@@ -25,19 +25,16 @@
|
||||
:wm-ignore false
|
||||
(clock))
|
||||
|
||||
(defpoll HOUR :interval "2s" `date +'%I'`)
|
||||
(defpoll MIN :interval "2s" `date +'%M'`)
|
||||
(defpoll MER :interval "2s" `date +'%p'`)
|
||||
(defpoll DAY :interval "5s" `date +'%A'`)
|
||||
(defpoll CLOCK :interval "4s" "date +'{\"hour\": \"%I\" ,\"min\": \"%M\" ,\"mer\" : \"%p\",\"day\" : \"%A\" }'")
|
||||
|
||||
(defwidget clock []
|
||||
(box :class "genwin" :orientation "h" :spacing 50 :space-evenly false :vexpand "false" :hexpand "false"
|
||||
(box :orientation "h" :spacing 0
|
||||
(label :class "time_hour" :valign "start" :wrap "true" :limit-width 25 :text HOUR)
|
||||
(label :class "time_min" :valign "end" :wrap "true" :limit-width 25 :text MIN))
|
||||
(label :class "time_hour" :valign "start" :wrap "true" :limit-width 25 :text "${CLOCK.hour}")
|
||||
(label :class "time_min" :valign "end" :wrap "true" :limit-width 25 :text "${CLOCK.min}"))
|
||||
(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_day" :valign "end" :halign "end" :wrap "true" :limit-width 25 :text DAY))))
|
||||
(label :class "time_mer" :valign "start" :halign "end" :wrap "true" :limit-width 25 :text "${CLOCK.mer}")
|
||||
(label :class "time_day" :valign "end" :halign "end" :wrap "true" :limit-width 25 :text "${CLOCK.day}"))))
|
||||
|
||||
;; music
|
||||
(defwindow music_0
|
||||
@@ -66,25 +63,23 @@
|
||||
:wm-ignore true
|
||||
(music))
|
||||
|
||||
(defpoll SONG :interval "2s" `./script song`)
|
||||
(defpoll ARTIST :interval "2s" `./script artist`)
|
||||
(defpoll STATUS :interval "0.4s" `./script status`)
|
||||
(defpoll COVER :interval "2s" `./script cover`)
|
||||
(defpoll CURRENT :interval "0.4s" `./script time`)
|
||||
(defpoll LYRICS :interval "0.4s" `./script lyrics`)
|
||||
(defpoll song :interval "2s" "./script songdata")
|
||||
(defpoll STATUS :interval "0.4s" "./script status")
|
||||
(defpoll CURRENT :interval "0.4s" "./script time")
|
||||
(defpoll LYRICS :interval "0.4s" "./script lyrics")
|
||||
|
||||
(defwidget music []
|
||||
(box :class "genwin" :orientation "h" :spacing 50 :space-evenly "false" :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
|
||||
(image :path COVER :image-height 300 :image-width 300)))
|
||||
(circular-progress :class "music_bar" :value CURRENT :thickness 10 :clockwise true :start-at "${(CURRENT+75)%100}"
|
||||
(image :path "${song.cover}" :image-height 270 :image-width 270)))
|
||||
(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 "artist" :wrap "false" :text ARTIST)
|
||||
(box :orientation "h" :spacing 30 :halign "center" :space-evenly "true" :vexpand "false" :hexpand "false"
|
||||
(button :class "btn_controls" :onclick "./script prev" "玲")
|
||||
(label :tooltip "${song.name}" :halign "center" :class "song" :wrap "false" :limit-width 20 :text "${song.name}")
|
||||
(label :halign "center" :class "artist" :wrap "false" :limit-width 20 :text "${song.artist}")
|
||||
(box :orientation "h" :spacing 35 :halign "center" :space-evenly "true" :vexpand "false" :hexpand "false"
|
||||
(button :class "btn_controls" :onclick "./script prev" "")
|
||||
(button :class "btn_controls" :onclick "./script seek '-1'" "")
|
||||
(button :class "btn_play" :onclick "./script play_toggle" STATUS)
|
||||
(button :class "btn_controls" :onclick "./script seek '1'" "")
|
||||
(button :class "btn_controls" :onclick "./script next" "怜"))
|
||||
(label :halign "center" :wrap "true" :class "lyrics" :text LYRICS))))
|
||||
(button :class "btn_controls" :tooltip "Upcoming : ${song.next}" :onclick "./script next" ""))
|
||||
(label :justify "left" :wrap "true" :class "lyrics" :text LYRICS))))
|
||||
|
||||
49
eww/script
49
eww/script
@@ -1,37 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
out=$(printf '{ "command": ["get_property", "pause"]}\n' | socat - /tmp/mpvsocket 2>/dev/null)
|
||||
case $1 in
|
||||
song)
|
||||
songdata)
|
||||
out=$(printf '{ "command": ["get_property", "pause"]}\n' | socat - /tmp/mpvsocket 2>/dev/null)
|
||||
if [ -n "$out" ] && pgrep -f mpvsocket >/dev/null 2>&1;then
|
||||
cut -d'>' -f1 < "/tmp/yt-music/current" | cut -d':' -f2 | sed 's|[^-]*$||;s|[-| ]$||'
|
||||
printf '{"name":"%s","artist":"%s","cover":"/tmp/yt-music/default.jpg","next":"%s"}' "$(cut -d'>' -f1 < "/tmp/yt-music/current" | cut -d':' -f2 | sed 's|[^-]*$||;s|-$||;s| $||;s|^ ||')" "$(cut -d'>' -f1 < "/tmp/yt-music/current" | sed 's_.* - __;s| $||')" "$(sed -n "/$(cut -d'>' -f2 < /tmp/yt-music/current )/{n;p}" /tmp/yt-music/next | cut -f1)"
|
||||
else
|
||||
printf "OFFLINE"
|
||||
fi
|
||||
;;
|
||||
artist)
|
||||
if [ -n "$out" ] && pgrep -f mpvsocket >/dev/null 2>&1;then
|
||||
cut -d'>' -f1 < "/tmp/yt-music/current" | sed 's_.* -__;s| $||'
|
||||
else
|
||||
printf "Offline"
|
||||
fi
|
||||
;;
|
||||
cover)
|
||||
if [ -n "$out" ] && pgrep -f mpvsocket >/dev/null 2>&1;then
|
||||
printf "/tmp/yt-music/default.jpg"
|
||||
else
|
||||
printf "%s/.config/eww/music.png" "$HOME"
|
||||
printf '{"name":"OFFLINE","artist":"offline","cover":"%s/.config/eww/music.png"}' "$HOME"
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
out=$(printf '{ "command": ["get_property", "pause"]}\n' | socat - /tmp/mpvsocket 2>/dev/null)
|
||||
if [ -z "$out" ];then
|
||||
printf ""
|
||||
elif printf "%s" "$out" | grep -q "true";then
|
||||
printf "喇"
|
||||
printf ""
|
||||
else
|
||||
printf ""
|
||||
printf ""
|
||||
fi
|
||||
;;
|
||||
lyrics)
|
||||
if [ -f "/tmp/yt-music/lyrics" ]; then
|
||||
awk -F'\t' -v value="$(echo '{ "command": ["get_property", "time-pos"] }' | socat - /tmp/mpvsocket | sed -nE 's|.*data":([^,]*).*|\1|p')" '$1 > value*1000 {print $2;exit}' /tmp/yt-music/lyrics
|
||||
else
|
||||
printf "Lyrics will show here"
|
||||
fi
|
||||
;;
|
||||
time)
|
||||
out=$(echo '{"command" :["get_property" , "percent-pos"]}' | socat - /tmp/mpvsocket 2>/dev/null | sed -nE 's_.*data":([^,]*).*_\1_p')
|
||||
printf '%s' "${out:-100}"
|
||||
;;
|
||||
play_toggle)
|
||||
echo cycle pause | socat - "/tmp/mpvsocket"
|
||||
;;
|
||||
@@ -44,18 +42,7 @@ case $1 in
|
||||
prev)
|
||||
pgrep -f mpvsocket >/dev/null 2>&1 && ("$HOME/repos_scripts/yt-music" play "$(sed 's| >|\t|g' /tmp/yt-music/prev | cut -d':' -f2)")
|
||||
;;
|
||||
time)
|
||||
out=$(echo '{"command" :["get_property" , "percent-pos"]}' | socat - /tmp/mpvsocket 2>/dev/null | sed -nE 's_.*data":([^,]*).*_\1_p')
|
||||
printf '%s' "${out:-100}"
|
||||
;;
|
||||
seek)
|
||||
echo "{\"command\" :[\"seek\" ,\"$2\",\"relative-percent\"]}" | socat - /tmp/mpvsocket
|
||||
;;
|
||||
lyrics)
|
||||
if [ -f "/tmp/yt-music/lyrics" ]; then
|
||||
sed -n "/^$(awk -v value="$(echo '{ "command": ["get_property", "time-pos"] }' | socat - /tmp/mpvsocket | sed -nE 's|.*data":([^,]*).*|\1|p')" '$1 > value*1000 {print $1;exit}' /tmp/yt-music/lyrics)\t/p" /tmp/yt-music/lyrics | cut -f2
|
||||
else
|
||||
printf "Lyrics will show here"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user