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

28 lines
863 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 "󰡀"
else
trackid=$(playerctl --player=playerctld metadata --format '{{ mpris:trackid }}')
title=$(playerctl --player=playerctld metadata --format '{{ xesam:title }}')
if grep -q -i "netflix" <<< "$title"; then
echo "󰝆"
elif grep -q -i "hulu" <<< "$title"; then
echo "󰠩"
elif grep -q -i "prime video" <<< "$title"; then
echo ""
elif grep -q -i "youtube tv" <<< "$title"; then
echo "󰑈"
elif grep -q -i "chromium" <<< "$trackid"; then
echo ""
elif grep -q -i "vlc" <<< "$trackid"; then
echo "󰕼"
elif grep -q -i "spotify" <<< "$trackid"; then
echo ""
else
echo "󰡀"
fi
fi