From d13cfb633d2f7bfe5f9f142956f7f0e41c378d2c Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Fri, 10 Jan 2025 17:12:14 -0600 Subject: [PATCH] fix(waybar): update media info on both poll and dbus --- .../dots/.config/waybar/scripts/get-media.bash | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/users/price/dots/.config/waybar/scripts/get-media.bash b/users/price/dots/.config/waybar/scripts/get-media.bash index c87829aa..7c7b3261 100755 --- a/users/price/dots/.config/waybar/scripts/get-media.bash +++ b/users/price/dots/.config/waybar/scripts/get-media.bash @@ -21,11 +21,22 @@ get-album-info() { printf '{"class": "%s", "text": "%s"}\n' "${class}" "${text}" } -main() { - get-album-info +album-info-dbus-update() { while IFS= read -r _; do get-album-info done < <(busctl --user monitor --json=short --match 'interface=org.mpris.MediaPlayer2.Player,type=signal') } +album-info-poller() { + while sleep 1; do + get-album-info + done +} + +main() { + album-info-dbus-update & + album-info-poller & + wait +} + main