dwm-flexipatch/polybar/scripts/get-media-playing.sh
Sravan Balaji 4f61dab020 Adjust Media Module Order
- Title then artist
- Replace blank title/artist with "N/A"
2022-05-01 16:44:50 -04:00

27 lines
779 B
Bash
Executable File

#!/bin/bash
mediaStatus=$(playerctl --player=playerctld metadata 2>&1)
if [[ "$mediaStatus" == "No player could handle this command" ]]; then
echo " N/A"
else
artist=$(playerctl --player=playerctld metadata --format '{{ artist }}')
title=$(playerctl --player=playerctld metadata --format '{{ title }}')
status=$(playerctl --player=playerctld metadata --format '{{ status }}')
if [[ $status == "Paused" ]]; then
status_icon=" "
elif [[ $status == "Playing" ]]; then
status_icon=" "
fi
if [[ $artist == "" ]]; then
artist="N/A"
fi
if [[ $title == "" ]]; then
title="N/A"
fi
echo "$status_icon $title - $artist"
fi