perf(waybar): only send media updates when necessary
Some checks failed
Check Formatting of Files / Check-Formatting (push) Failing after 37s
Some checks failed
Check Formatting of Files / Check-Formatting (push) Failing after 37s
This commit is contained in:
parent
4b0fba074b
commit
3b4d97ac79
@ -3,8 +3,6 @@
|
|||||||
get-album-info() {
|
get-album-info() {
|
||||||
local class
|
local class
|
||||||
local text=""
|
local text=""
|
||||||
|
|
||||||
while :; do
|
|
||||||
if class="$(playerctl metadata --format '{{lc(status)}}')"; then
|
if class="$(playerctl metadata --format '{{lc(status)}}')"; then
|
||||||
local player_ctl_info
|
local player_ctl_info
|
||||||
player_ctl_info="$(playerctl metadata --format '{{ artist }} | {{ title }} | {{ album }}')"
|
player_ctl_info="$(playerctl metadata --format '{{ artist }} | {{ title }} | {{ album }}')"
|
||||||
@ -21,12 +19,13 @@ get-album-info() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
printf '{"class": "%s", "text": "%s"}\n' "${class}" "${text}"
|
printf '{"class": "%s", "text": "%s"}\n' "${class}" "${text}"
|
||||||
sleep .5
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
get-album-info
|
get-album-info
|
||||||
|
while IFS= read -r _; do
|
||||||
|
get-album-info
|
||||||
|
done < <(busctl --user monitor --json=short --match 'interface=org.mpris.MediaPlayer2.Player,type=signal')
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
Loading…
x
Reference in New Issue
Block a user