changed things...

This commit is contained in:
coolnsx
2023-01-02 23:56:10 +05:30
parent 04c6ec94be
commit 1f568f3cc2
9 changed files with 253 additions and 12 deletions

102
eww/eww.scss Normal file
View File

@@ -0,0 +1,102 @@
* {
all: unset;
}
/** Background ***************************************/
.bg {
background-color: rgba(0,0,0,0);
opacity: 0;
}
/** Generic window ***********************************/
.genwin {
background-color: rgba(0,0,0,0);
border-radius: 16px;
}
/** Clock ********************************************/
.time_hour, .time_min {
color: #DA0F67;
font-size : 70px;
font-weight : bold;
}
.time_hour {
margin : 15px 0px 0px 20px;
}
.time_min {
margin : 0px 0px 10px 0px;
}
.time_mer {
color: #A3BE8C;
font-size : 40px;
font-weight : bold;
margin : 20px 0px 0px 0px;
}
.time_day {
color: #EBCB8B;
font-size : 30px;
font-weight : normal;
margin : 0px 0px 20px -20px;
}
/** Music ***************************************/
.album_art {
background-size: cover;
background-repeat:no-repeat;
background-color: rgba(0,0,0,0);
min-height: 210px;
min-width: 210px;
margin: 0px 50px 0px 0px;
border-radius: 15px;
border-style:none;
}
.song {
color: #DA0F67;
font-size : 24px;
font-weight : bold;
margin : 5px 0px 0px 0px;
}
.artist {
color: #EBCB8B;
font-size : 20px;
font-weight : normal;
margin : 0px 0px -10px 0px;
}
.btn_play {
margin : 0px 0px 0px 0px;
color: #A3BE8C;
font-size : 70px;
font-weight : bold;
}
.btn_prev {
color: #EBCB8B;
font-size : 32px;
font-weight : normal;
}
.btn_next {
color: #EBCB8B;
font-size : 32px;
font-weight : normal;
}
.music_bar scale trough highlight {
all: unset;
background-image: linear-gradient(to right, #8A3288 30%, #8A32AA 50%, #8A326F 100% *50);
border-radius: 24px;
}
.music_bar scale trough {
all: unset;
background-color: #232232;
border-radius: 24px;
min-height: 13px;
min-width: 190px;
margin : -22px 0px 10px 0px;
}

89
eww/eww.yuck Normal file
View File

@@ -0,0 +1,89 @@
;;time
(defwindow time_1
:monitor 1
:geometry (geometry :x "-10px"
:y "30px"
:width "20%"
:height "200px"
:anchor "top right")
:stacking "bg"
:reserve (struts :distance "40px" :side "top")
:windowtype "dock"
:wm-ignore false
(clock))
(defwindow time_0
:monitor 0
:geometry (geometry :x "-10px"
:y "20px"
:width "20%"
:height "200px"
:anchor "top right")
:stacking "bg"
:reserve (struts :distance "40px" :side "top")
:windowtype "dock"
:wm-ignore false
(clock))
(defpoll HOUR :interval "5s" `date +\"%I\"`)
(defpoll MIN :interval "5s" `date +\"%M\"`)
(defpoll MER :interval "5s" `date +\"%p\"`)
(defpoll DAY :interval "5s" `date +\"%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))
(box :orientation "v" :spacing 0
(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))))
;; music
(defwindow music_0
:monitor 0
:geometry (geometry :x "50"
:y "50"
:width "20%"
:height "0px"
:anchor "bottom left")
:stacking "bg"
:reserve (struts :distance "10px" :side "bottom")
:windowtype "dock"
:wm-ignore true
(music))
(defwindow music_1
:monitor 1
:geometry (geometry :x "50"
:y "50"
:width "20%"
:height "0px"
:anchor "bottom left")
:stacking "bg"
:reserve (struts :distance "10px" :side "bottom")
:windowtype "dock"
:wm-ignore true
(music))
(defpoll SONG :interval "1s" `./script song`)
(defpoll ARTIST :interval "1s" `./script artist`)
(defpoll STATUS :interval "0.5s" `./script status`)
(defpoll COVER :interval "1s" `./script cover`)
(defpoll CURRENT :interval "1s" `./script time`)
(defwidget music []
(box :class "genwin" :orientation "h" :space-evenly "false" :vexpand "true" :hexpand "false"
(box :class "album_art" :vexpand "false" :hexpand "false" :style "background-image: url('${COVER}');")
(box :orientation "v" :spacing 20 :space-evenly "false" :vexpand "false" :hexpand "false"
(label :halign "center" :class "song" :wrap "false" :limit-width 40 :text SONG)
(label :halign "center" :class "artist" :wrap "false" :text ARTIST)
(box :orientation "h" :spacing 20 :halign "center" :space-evenly "true" :vexpand "false" :hexpand "false"
(button :class "btn_prev" :onclick "./script prev" "玲")
(button :class "btn_prev" :onclick "./script seek '-1'" "")
(button :class "btn_play" :onclick "./script play_toggle" STATUS)
(button :class "btn_next" :onclick "./script seek '1'" "")
(button :class "btn_next" :onclick "./script next" "怜"))
(box :class "music_bar" :halign "center" :vexpand "false" :hexpand "false" :space-evenly "false"
(scale :min 0 :active "true" :max 100 :value CURRENT))
)))

BIN
eww/music.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

52
eww/script Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/sh
out=$(echo '{ "command": ["get_property", "pause"]}' | socat - /tmp/mpvsocket 2>/dev/null)
case $1 in
song)
if [ -n "$out" ];then
cut -d'>' -f1 < "$HOME/.cache/yt-music/current" | cut -d':' -f2 | sed 's|[^-]*$||;s|-$||'
else
echo "Offline"
fi
;;
artist)
if [ -n "$out" ];then
cut -d'>' -f1 < "$HOME/.cache/yt-music/current" | sed 's_.* -__'
else
echo "Offline"
fi
;;
cover)
if [ -n "$out" ];then
echo "$HOME/.cache/yt-music/default.jpg"
else
echo "$HOME/.config/eww/music.png"
fi
;;
status)
if [ -z "$out" ];then
printf ""
elif printf "%s" "$out" | grep -q "true";then
echo "喇"
else
echo ""
fi
;;
play_toggle)
echo cycle pause | socat - "/tmp/mpvsocket"
;;
next)
$HOME/repos_scripts/yt-music play_next >/dev/null
;;
prev)
$HOME/repos_scripts/yt-music play "$(sed 's| >|\t|g' $HOME/.cache/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')
[ -z "$out" ] && echo "0" || echo "$out"
;;
seek)
echo "{\"command\" :[\"seek\" ,\"$2\",\"relative-percent\"]}" | socat - /tmp/mpvsocket
;;
esac