Skip to content

Instantly share code, notes, and snippets.

@jn64
Created May 19, 2020 12:40
Show Gist options
  • Save jn64/8b412733667e30bf63bf9d4ba1852691 to your computer and use it in GitHub Desktop.
Save jn64/8b412733667e30bf63bf9d4ba1852691 to your computer and use it in GitHub Desktop.
ncmpcpp notifications with album art
#!/bin/bash
# Send notification with album art when ncmpcpp plays a new song
# execute_on_song_change must be set in ncmpcpp config
readonly MUSIC_DIR="${HOME}/Music/Library"
readonly SONG_PATH="$(mpc --format '%file%' current)"
readonly SONG_DIR="$(dirname "${SONG_PATH}")"
readonly ALBUM_ART_PATH="${MUSIC_DIR}/${SONG_DIR}/cover.jpg"
# if [[ ! -f "${ALBUM_ART_PATH}" ]]; then # file doesn't exist
# ALBUM_ART_PATH="" # TODO: insert path to generic icon here
# fi
notify-send -i "${ALBUM_ART_PATH}" "Now Playing" "$(mpc --format '%title% - %artist%' current)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment