aboutsummaryrefslogtreecommitdiff
path: root/mpdlrc-notify-send
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2015-12-05 12:59:58 +1300
committerTom Ryder <tom@sanctum.geek.nz>2015-12-05 12:59:58 +1300
commit8571b74c829b8369eb7c11bb4cf7cbf52aa10d0b (patch)
tree7095d8edbb6531846326d8857595314dc3642c20 /mpdlrc-notify-send
parentExit child once done with printing (diff)
downloadmpdlrc-8571b74c829b8369eb7c11bb4cf7cbf52aa10d0b.tar.gz
mpdlrc-8571b74c829b8369eb7c11bb4cf7cbf52aa10d0b.zip
Add mplrc-notify-send example
Diffstat (limited to 'mpdlrc-notify-send')
-rwxr-xr-xmpdlrc-notify-send16
1 files changed, 16 insertions, 0 deletions
diff --git a/mpdlrc-notify-send b/mpdlrc-notify-send
new file mode 100755
index 0000000..977cf1b
--- /dev/null
+++ b/mpdlrc-notify-send
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+# Check we have the two programs we need
+hash mpdlrc || exit
+hash notify-send || exit
+
+# Read the priority and timeout from the environment, or set default values
+priority=${MPDLC_PRIORITY:-low}
+timeout=${MPDLC_TIMEOUT:-2000}
+
+# Loop over each line output by mpdlrc (which will need to be somewhere in your
+# PATH) and pass it to notify-send(1)
+while IFS= read -r lyric ; do
+ notify-send -u "$priority" -t "$timeout" "$lyric"
+done < <(mpdlrc)
+