#!/bin/sh # This is a static status module, for a dynamic one, there is the option # with zscroll. icon="" length=50 delay=0.1 b_padding="$icon " a_padding="" p_padding="  |  " show_panel (){ zscroll -d $delay -l $length \ -M "pctl_status status" \ -m "Playing" "--scroll-padding '$p_padding' --scroll 1" \ -m "Paused" "--scroll 0" \ -m "Stopped" "--scroll 0" \ -m "NRP" "--scroll 0" \ -u true "pctl_status text" & wait } send_notification (){ player_status="$(pctl_status status)" metadata="$(pctl_status get-metadata)" contains_album="$(echo $metadata | cut -d'>' -f1)" artist= album= title= summary= body= pp_icon= if [ "$player_status" = "Playing" ] || [ "$player_status" = "Paused" ]; then if [ "$contains_album" = "yes" ]; then artist="$(echo $metadata | cut -d'>' -f2)" album="$(echo $metadata | cut -d'>' -f3)" title="$(echo $metadata | cut -d'>' -f4)" summary="$artist ($album)" body="$title" else artist="$(echo $metadata | cut -d'>' -f2)" title="$(echo $metadata | cut -d'>' -f3)" summary="$artist" body="$title" fi if [ "$player_status" = "Playing" ]; then pp_icon="" else pp_icon="" fi notify-send -u low "$icon $pp_icon $summary" "$body" else notify-send -u low "$icon Nothing playing" fi } case $1 in show) show_panel ;; notify) send_notification ;; esac