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() {
|
||||
local class
|
||||
local text=""
|
||||
|
||||
while :; do
|
||||
if class="$(playerctl metadata --format '{{lc(status)}}')"; then
|
||||
local player_ctl_info
|
||||
player_ctl_info="$(playerctl metadata --format '{{ artist }} | {{ title }} | {{ album }}')"
|
||||
@ -21,12 +19,13 @@ get-album-info() {
|
||||
fi
|
||||
|
||||
printf '{"class": "%s", "text": "%s"}\n' "${class}" "${text}"
|
||||
sleep .5
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user