eww code refactor

This commit is contained in:
coolnsx
2023-09-03 21:41:48 +05:30
parent e6916fe766
commit b0f598bec3
5 changed files with 65 additions and 87 deletions

View File

@@ -3,17 +3,11 @@
}
/** Background ***************************************/
.bg {
background-color: rgba(0,0,0,0);
opacity: 0;
}
/** Generic window ***********************************/
.genwin {
//background-color: rgba(39, 40, 34, 0.7);
background-color: rgba(0,0,0,0);
border-radius: 16px;
border-radius: 8rem;
}
/** Clock ********************************************/
@@ -28,14 +22,12 @@
.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;
@@ -43,60 +35,35 @@
margin : 0px 0px 20px 0px;
}
/** Music ***************************************/
.album_art {
background-size: cover;
background-repeat:no-repeat;
background-color: rgba(0,0,0,0);
min-height: 240px;
min-width: 240px;
margin: 0px 50px 0px 0px;
border-radius: 15px;
border-style:none;
}
/** Music ********************************************/
.song {
color: #8FBCBB;
font-size : 24px;
font-weight : bold;
margin : 10px 0px 0px 0px;
}
.artist {
color: #EBCB8B;
font-size : 20px;
font-weight : normal;
margin : 0px 0px 0px 0px;
}
.btn_play {
margin : 0px 0px 0px 0px;
color: #A3BE8C;
font-family: IosevkaTerm Nerd Font Mono;
font-size : 70px;
}
.btn_prev {
.btn_play:hover {
color: #A2A852;
}
.btn_controls {
color: #EBCB8B;
font-size : 32px;
font-weight : normal;
font-family: IosevkaTerm Nerd Font Mono;
}
.btn_next {
color: #EBCB8B;
font-size : 32px;
font-weight : normal;
.btn_controls:hover {
font-size : 50px;
}
.music_bar scale trough highlight {
all: unset;
background-image: linear-gradient(to right, #77a5bf 30%, #91bdce 50%, #afcee0 100% *50);
border-radius: 24px;
}
.music_bar scale trough {
background-color: #232232;
border-radius: 24px;
min-height: 13px;
min-width: 190px;
margin : 0px 0px 10px 0px;
.music_bar {
color: #81A1C1;
background-color: rgba(0,0,0,0.1);
}

View File

@@ -10,7 +10,8 @@
:reserve (struts :distance "40px" :side "top")
:windowtype "dock"
:wm-ignore false
(clock))
(clock)
)
(defwindow time_0
:monitor 0
@@ -23,21 +24,25 @@
:reserve (struts :distance "40px" :side "top")
:windowtype "dock"
:wm-ignore false
(clock))
(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 HOUR :interval "2s" $(date +'%I'))
(defpoll MIN :interval "2s" $(date +'%M'))
(defpoll MER :interval "2s" $(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 :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))))
(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 :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)
)
)
)
;; music
(defwindow music_0
@@ -51,7 +56,8 @@
:reserve (struts :distance "10px" :side "bottom")
:windowtype "dock"
:wm-ignore true
(music))
(music)
)
(defwindow music_1
:monitor 1
@@ -64,30 +70,32 @@
:reserve (struts :distance "10px" :side "bottom")
:windowtype "dock"
:wm-ignore true
(music))
(music)
)
(defpoll SONG :interval "2s" `./script song`)
(defpoll ARTIST :interval "2s" `./script artist`)
(defpoll STATUS :interval "0.5s" `./script status`)
(defpoll COVER :interval "2s" `./script cover`)
(defpoll CURRENT :interval "1s" `./script time`)
(defpoll LYRICS :interval "0.4s" `./script lyrics`)
(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))
(defwidget music []
(box :class "genwin" :orientation "v" :spacing 20 :space-evenly "false" :vexpand "true" :hexpand "true"
(box :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 25 :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))))
(label :halign "center" :class "artist" :text LYRICS)))
(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)))
(box :orientation "v" :spacing 15 :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 20 :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 "artist" :text LYRICS)
)
)
)

BIN
eww/music.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 26 KiB

BIN
eww/music.png.bak Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

View File

@@ -6,12 +6,12 @@ case $1 in
if [ -n "$out" ] && pgrep -f mpvsocket >/dev/null 2>&1;then
cut -d'>' -f1 < "/tmp/yt-music/current" | cut -d':' -f2 | sed 's|[^-]*$||;s|-$||'
else
printf "Music widget by Coolans X"
printf "OFFLINE"
fi
;;
artist)
if [ -n "$out" ] && pgrep -f mpvsocket >/dev/null 2>&1;then
cut -d'>' -f1 < "/tmp/yt-music/current" | sed 's_.* -__'
cut -d'>' -f1 < "/tmp/yt-music/current" | sed 's_.* -__;s| $||'
else
printf "Offline"
fi
@@ -38,6 +38,9 @@ case $1 in
next)
pgrep -f mpvsocket >/dev/null 2>&1 && "$HOME/repos_scripts/yt-music" play_next
;;
next_song)
sed -n "$(cat /tmp/yt-music/counter){n;p}" /tmp/yt-music/next | cut -f1
;;
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)")
;;
@@ -52,7 +55,7 @@ case $1 in
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 By musixmatch"
printf "Lyrics will show here"
fi
;;
esac