Updated polybar with my own music script

This commit is contained in:
Michał Gdula 2022-08-25 13:36:36 +01:00
parent ea4e3a6be9
commit d8be95b8d2
8 changed files with 31 additions and 32 deletions

20
polybar/scripts/music.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/sh
player=$(playerctl -p %any,firefox status)
title=$(playerctl -p %any,firefox metadata --format '{{ title }}')
artist=$(playerctl -p %any,firefox metadata --format '{{ artist }}')
if [ $player = "Playing" ]
then
if [ "$title" == "" ]
then
$title="Unknow title"
fi
if [ "$artist" == "" ]
then
$artist = "Unknow artist"
fi
echo "%{F#151515}%{T2}%{T- F-}%{B#151515}"$title", "$artist"%{B-}%{F#151515}%{T2}%{T- F-}"
#else
# echo ""
fi