Skip to content

Instantly share code, notes, and snippets.

@notjuliee
Created November 17, 2017 03:39
Show Gist options
  • Save notjuliee/36e0f5cc7b7310b92adf1dcc7481d0b6 to your computer and use it in GitHub Desktop.
Save notjuliee/36e0f5cc7b7310b92adf1dcc7481d0b6 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Parse arguments into variables
while test $# -ge 2; do
eval _$1='$2'
shift
shift
done
# Check that file actually exists
if test -n "$_file"; then
# Log status to file
echo "[$(date '+%x %R:%S')][$_status] $_artist - $_album - $_title" >> ~/.config/cmus/status_log.txt
if [ $_status == "playing" ]; then
# Pull current song icon into ~/.config/cmus/np_icon.jpg
rm ~/.config/cmus/np_icon.jpg
ffmpeg -i "$_file" -an -vcodec copy ~/.config/cmus/np_icon.jpg
# Show notification
notify-send -i ~/.config/cmus/np_icon.jpg "Now Playing" "$_artist - $_album - $_title"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment