Created
February 10, 2022 20:15
-
-
Save chaudum/6a7c2f63cce6eca91ca5f41e8a0aad24 to your computer and use it in GitHub Desktop.
i3block mpd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
mpc idle > /dev/null | |
TRACK="$(mpc -f '%title%' current)" | |
# long version | |
if [ ${#TRACK} -gt 60 ]; then | |
echo "${TRACK:0:57}..." | |
else | |
echo $TRACK | |
fi | |
# short version | |
if [ ${#TRACK} -gt 40 ]; then | |
echo "${TRACK:0:37}..." | |
else | |
echo $TRACK | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment