Fix polybar player-mpris script

This commit is contained in:
Tobias Reisinger 2023-01-03 02:15:35 +01:00
parent 499c012601
commit c9026ce0c1
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
2 changed files with 6 additions and 5 deletions

View file

@ -11,6 +11,7 @@ declare -A mapper=(
["git"]="$HOME/.config/git/config"
["git-ignore"]="$HOME/.config/git/ignore"
["home-manager"]="$HOME/.config/nixpkgs/home.nix"
["polybar"]="$HOME/.config/polybar"
["qutebrowser"]="$HOME/.config/qutebrowser/common.py"
["starship"]="$HOME/.config/starship.toml"
["sxhkd"]="$HOME/.config/sxhkd/sxhkdrc"

View file

@ -1,13 +1,13 @@
#!/bin/sh
#!/usr/bin/env sh
alias playerctl="playerctl -p spotifyd"
playerctl="playerctl -p spotifyd"
player_status=$(playerctl status 2> /dev/null)
player_status=$($playerctl status 2> /dev/null)
if [ "$player_status" = "Playing" ]; then
echo "$(playerctl metadata -f '{{title}} - {{artist}} | {{duration(position)}}/{{duration(mpris:length)}}')"
echo "$($playerctl metadata -f '{{title}} - {{artist}} | {{duration(position)}}/{{duration(mpris:length)}}')"
elif [ "$player_status" = "Paused" ]; then
echo "$(playerctl metadata -f '{{title}} - {{artist}} | {{duration(position)}}/{{duration(mpris:length)}}')"
echo "$($playerctl metadata -f '{{title}} - {{artist}} | {{duration(position)}}/{{duration(mpris:length)}}')"
else
echo ""
fi