-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnotify
More file actions
executable file
·26 lines (19 loc) · 842 Bytes
/
notify
File metadata and controls
executable file
·26 lines (19 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env sh
# Directory where to store temporary data
TMP_DIR="/tmp/rmpc"
# Ensure the directory is created
mkdir -p "$TMP_DIR"
# Where to temporarily store the album art received from rmpc
ALBUM_ART_PATH="$TMP_DIR/notification_cover"
# Path to fallback album art if no album art is found by rmpc/mpd
# Change this to your needs
DEFAULT_ALBUM_ART_PATH="$TMP_DIR/default_album_art.jpg"
# Save album art of the currently playing song to a file
if ! rmpc albumart --output "$ALBUM_ART_PATH"; then
# Use default album art if rmpc returns non-zero exit code
ALBUM_ART_PATH="${DEFAULT_ALBUM_ART_PATH}"
fi
MSG_TITLE=$(urlencode "$TITLE")
MSG_ARTIST=$(urlencode "$ARTIST")
# Integrates with hammerspoon, but use whatever terminal notifier you have set up.
open "hammerspoon://canvasNotify?line1=$TITLE&line2=$ARTIST&duration=3"