aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.markdown5
-rwxr-xr-xmpdlrc-notify-send16
2 files changed, 19 insertions, 2 deletions
diff --git a/README.markdown b/README.markdown
index 2e7fdc4..2cacbef 100644
--- a/README.markdown
+++ b/README.markdown
@@ -10,8 +10,9 @@ Needs `Net::MPD` and a few core Perl packages. Expects to find lyrics named
This code is not great. It will be improved. It needs to be more configurable
from environment variables or options, for one thing.
-This could maybe be used with `dzen` or a similar desktop notification tool to
-display lyrics in a corner as you work on other things.
+This could maybe be used with `libnotify` or a similar desktop notification
+tool to display lyrics in a corner as you work on other things. I've included a
+simple Bash wrapper around `notify-send(1)` which works for me.
An LRC file I made for Darkthrone's "To Walk The Infernal Fields" from their
1993 album "Under a Funeral Moon" is included for testing.
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)
+