summaryrefslogtreecommitdiff
path: root/ar/.local/bin/statusbar/sb-playerctlup
blob: a5c0763be254e032727d96bfa535be2778675c1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

# Updates the music statusbar module when a playerctl-compatible player changes

signal() { kill -52 $(pidof "${STATUSBAR:-dwmblocks}") 2>/dev/null; }

playerctl -aF status 2>/dev/null | while read -r _; do signal; done &
playerctl -aF metadata -f '{{playerName}}{{title}}' 2>/dev/null | while read -r _; do signal; done &

dbus-monitor --session "interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.mpris.MediaPlayer2.Player'" 2>/dev/null |
  while read -r line; do
    case "$line" in
      *PropertiesChanged*) signal ;;
    esac
  done &

wait