dwm-flexipatch/polybar/scripts/get-media-playing.sh
2024-03-30 20:03:08 -04:00

20 lines
527 B
Bash
Executable File

#!/usr/bin/env 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 }}')
if [[ $artist == "" ]]; then
artist="N/A"
fi
if [[ $title == "" ]]; then
title="N/A"
fi
echo "󰝚 $title | 󰠃 $artist"
fi