#!/bin/bash players="spotify,%any,firefox,chromium,brave,mpd" player_status=$(playerctl -p $players status) script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) exit=$? scroll () { zscroll -l 20 \ --delay 1 \ --scroll-padding " | " \ --match-command "$script_dir/scroll scroll-music" \ --match-text "Playing" "--scroll 1" \ --match-text "Paused" "--scroll 0" \ --update-check true "$script_dir/scroll" & wait } if [ $exit -eq 0 ]; then status=$player_status else status="Offline" fi if [ "$1" == "scroll-music" ]; then echo $status else if [ $status = "Stopped" ]; then echo "Offline" elif [ $status = "Paused" ]; then playerctl -p $players metadata --format '{{ artist }} - {{ title }}' elif [ $status = "Offline" ]; then echo $status else playerctl -p $players metadata --format '{{ artist }} - {{ title }}' fi fi case $1 in scroll-toggle) scroll ;; esac