#!/usr/bin/env zsh # Get current song info from MPD and send it via DBUS to nheko to display as # status message. setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL local oldstatus while :; do local mpdstatus=$(mpc current --format \ '[np: %title%[ by [%albumartist%|%artist%][ \[from %album%\]]]]') if [[ ${mpdstatus} != ${oldstatus} ]]; then dbus-send --print-reply \ --dest=im.nheko.Nheko / im.nheko.Nheko.setStatusMessage \ "string:${mpdstatus}" oldstatus=${mpdstatus} fi if [[ -z ${mpdstatus} ]]; then sleep 10 else sleep 1 fi done