feat: don't update current song pos when hovering on slider
This commit is contained in:
parent
f7997e8331
commit
256f0af183
2 changed files with 6 additions and 1 deletions
|
@ -11,6 +11,7 @@
|
||||||
(defpoll repeat_icon :interval "1s" "$EWW_PATH/music.sh loop_status")
|
(defpoll repeat_icon :interval "1s" "$EWW_PATH/music.sh loop_status")
|
||||||
(defvar song_pos "0")
|
(defvar song_pos "0")
|
||||||
(defpoll song_length :interval "1s" "$EWW_PATH/music.sh length")
|
(defpoll song_length :interval "1s" "$EWW_PATH/music.sh length")
|
||||||
|
(defvar get_pos "true")
|
||||||
|
|
||||||
(defwidget playerinfo []
|
(defwidget playerinfo []
|
||||||
(centerbox :class "playerinfo"
|
(centerbox :class "playerinfo"
|
||||||
|
@ -69,6 +70,8 @@
|
||||||
(eventbox :cursor "pointer"
|
(eventbox :cursor "pointer"
|
||||||
:class "song-pos"
|
:class "song-pos"
|
||||||
:hexpand true
|
:hexpand true
|
||||||
|
:onhover "eww update get_pos=false"
|
||||||
|
:onhoverlost "eww update get_pos=true"
|
||||||
(scale :value song_pos
|
(scale :value song_pos
|
||||||
:min 0
|
:min 0
|
||||||
:max song_length
|
:max song_length
|
||||||
|
|
|
@ -42,7 +42,9 @@ loop_status() {
|
||||||
}
|
}
|
||||||
|
|
||||||
get_length() {
|
get_length() {
|
||||||
|
if [[ $(eww get get_pos) == "true" ]]; then
|
||||||
eww update song_pos="$(playerctl -p spotify position)"
|
eww update song_pos="$(playerctl -p spotify position)"
|
||||||
|
fi
|
||||||
eww update song_length="$(echo "$(playerctl -p spotify metadata mpris:length)/1000000" | bc -l)"
|
eww update song_length="$(echo "$(playerctl -p spotify metadata mpris:length)/1000000" | bc -l)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue