|author||Tom Ryder <firstname.lastname@example.org>||2015-12-05 12:59:58 +1300|
|committer||Tom Ryder <email@example.com>||2015-12-05 12:59:58 +1300|
|parent||Exit child once done with printing (diff)|
Add mplrc-notify-send example
2 files changed, 19 insertions, 2 deletions
diff --git a/README.markdown b/README.markdown
index 2e7fdc4..2cacbef 100644
@@ -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
@@ -0,0 +1,16 @@
+# 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
+# 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)