feat: don't update current song pos when hovering on slider

This commit is contained in:
matt1432 2023-08-19 17:30:59 -04:00
parent f7997e8331
commit 256f0af183
2 changed files with 6 additions and 1 deletions

View file

@ -11,6 +11,7 @@
(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")
(defvar get_pos "true")
(defwidget playerinfo []
(centerbox :class "playerinfo"
@ -69,6 +70,8 @@
(eventbox :cursor "pointer"
:class "song-pos"
:hexpand true
:onhover "eww update get_pos=false"
:onhoverlost "eww update get_pos=true"
(scale :value song_pos
:min 0
:max song_length

View file

@ -42,7 +42,9 @@ loop_status() {
}
get_length() {
eww update song_pos="$(playerctl -p spotify position)"
if [[ $(eww get get_pos) == "true" ]]; then
eww update song_pos="$(playerctl -p spotify position)"
fi
eww update song_length="$(echo "$(playerctl -p spotify metadata mpris:length)/1000000" | bc -l)"
}