#!/bin/sh # This is a static status module, for a dynamic one, there is the option # with zscroll. icon=" " show_panel (){ # Needs to send to /dev/null for the actual else case. player_status=$(playerctl status 2> /dev/null) if [ "$player_status" = "Playing" ]; then echo "$icon $(playerctl metadata artist) - $(playerctl metadata title)" elif [ "$player_status" = "Paused" ]; then echo "%{F$(xresource color8)}$icon $(playerctl metadata artist) - $(playerctl metadata title)%{F-}" else echo "%{F$(xresource color8)}$icon (nothing playing)" fi } send_notification (){ player_status=$(playerctl status 2> /dev/null) if [ "$player_status" = "Playing" ]; then artist="$(playerctl metadata artist)" album="$(playerctl metadata album)" title="$(playerctl metadata title)" if [ $album = "\n"]; then notify-send "$icon $artist - $album" "$title" else notify-send "$icon $artist" "$title" fi elif [ "$player_status" = "Paused" ]; then artist="$(playerctl metadata artist)" album="$(playerctl metadata album)" title="$(playerctl metadata title)" if [ $album = "\n"]; then notify-send "$icon (Paused) $artist - $album" "$title" else notify-send "$icon (Paused) $artist" "$title" fi else notify-send "$icon Nothing playing" fi } case $1 in show) show_panel ;; notify) send_notification ;; esac