Skip to content

Instantly share code, notes, and snippets.

@chaudum
Created February 10, 2022 20:15
Show Gist options
  • Save chaudum/6a7c2f63cce6eca91ca5f41e8a0aad24 to your computer and use it in GitHub Desktop.
Save chaudum/6a7c2f63cce6eca91ca5f41e8a0aad24 to your computer and use it in GitHub Desktop.
i3block mpd
#!/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