diff options
Diffstat (limited to '.local/bin/pctl_status')
-rwxr-xr-x | .local/bin/pctl_status | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/.local/bin/pctl_status b/.local/bin/pctl_status new file mode 100755 index 0000000..0eccfb8 --- /dev/null +++ b/.local/bin/pctl_status @@ -0,0 +1,30 @@ +#!/bin/bash + +playerctl_status=$(playerctl status 2>/dev/null) +exit_code=$? + +if [ $exit_code -eq 0 ]; then + status=$playerctl_status +else + status="NPF" +fi + +case $1 in + status) + echo "$status" + ;; + text) + artist="$(playerctl metadata artist 2>/dev/null)" + title="$(playerctl metadata title 2>/dev/null)" + + if [ "$status" = "Stopped" ]; then + echo "%{F$(xresource color8)}No music playing%{F}" + elif [ "$status" = "Paused" ]; then + echo "%{F$(xresource color8)}$artist - $title%{F}" + elif [ "$status" = "NPF" ]; then + echo "%{F$(xresource color8)}No player found%{F}" + else + echo "$artist - $title" + fi + ;; +esac |