feat(eww): add spotify slider and bc package

This commit is contained in:
matt1432 2023-08-17 23:58:40 -04:00
parent 85703c9e14
commit 14cb44c397
5 changed files with 51 additions and 1 deletions

View file

@ -6,7 +6,7 @@ what is currently not working:
what i want to do:
- learn flakes
- add music widget in eww control center
- add auto-rotate widget in eww control center
# Docs

View file

@ -62,3 +62,29 @@
padding-right: 8px;
}
}
.song-pos {
scale {
highlight {
margin: 0px;
border-radius: 2em;
}
trough {
background-color: #363847;
border-radius: 2em;
}
slider {
margin: -8px;
min-height: 20px;
border-radius: 10px;
box-shadow: rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px;
transition: background-color 0.5s ease-in-out;
}
slider:hover {
background-color: #303240;
transition: background-color 0.5s ease-in-out;
}
}
}

View file

@ -9,6 +9,8 @@
(defvar button_height "42")
(defpoll shuffle_status :interval "1s" "playerctl -p spotify shuffle")
(defpoll repeat_icon :interval "1s" "$EWW_PATH/music.sh loop_status")
(defvar song_pos "0")
(defpoll song_length :interval "1s" "$EWW_PATH/music.sh length")
(defwidget playerinfo []
(centerbox :class "playerinfo"
@ -54,6 +56,8 @@
)
(box :class "bottom"
:style "color: ${button_accent};"
:space-evenly false
:spacing 0
(eventbox :valign "end"
:halign "start"
:onclick "playerctl -p spotify previous & $EWW_PATH/music.sh cover"
@ -62,6 +66,19 @@
:cursor "pointer"
"󰒮"
)
(eventbox :cursor "pointer"
:class "song-pos"
:hexpand true
(scale :value song_pos
:min 0
:max song_length
:orientation "h"
:onchange "playerctl -p spotify position {}"
:css "highlight { background-color: ${button_accent}; }
slider { background-color: ${button_accent}; }
trough { background-color: rgba(${button_accent}, 0.4); }"
)
)
(box :valign "end"
:halign "end"

View file

@ -41,6 +41,11 @@ loop_status() {
esac
}
get_length() {
eww update song_pos="$(playerctl -p spotify position)"
eww update song_length="$(echo "$(playerctl -p spotify metadata mpris:length)/1000000" | bc -l)"
}
get_accents() {
accents="$(coloryou /tmp/cover.jpg | sed 's/,//g' | sed 's/}//' | sed 's/'\''//g')"
music_accent=$(echo "$accents" | awk '{ print $2 }')
@ -74,4 +79,5 @@ get_cover() {
[[ "$1" == "accents" ]] && get_accents
[[ "$1" == "loop" ]] && loop
[[ "$1" == "loop_status" ]] && loop_status
[[ "$1" == "length" ]] && get_length
[[ "$1" == "cover" ]] && get_cover

View file

@ -69,6 +69,7 @@
tutanota-desktop
input-emulator
bc
swayosd
blueberry
libayatana-appindicator