From 256f0af183aa24310b3a37675c6eda825efadd21 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sat, 19 Aug 2023 17:30:59 -0400 Subject: [PATCH] feat: don't update current song pos when hovering on slider --- config/eww/playerinfo/playerinfo.yuck | 3 +++ config/eww/scripts/music.sh | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config/eww/playerinfo/playerinfo.yuck b/config/eww/playerinfo/playerinfo.yuck index 9bebd491..f426aa6c 100644 --- a/config/eww/playerinfo/playerinfo.yuck +++ b/config/eww/playerinfo/playerinfo.yuck @@ -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 diff --git a/config/eww/scripts/music.sh b/config/eww/scripts/music.sh index 49174b4f..acceaeb9 100755 --- a/config/eww/scripts/music.sh +++ b/config/eww/scripts/music.sh @@ -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)" }