diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2015-12-05 12:59:58 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2015-12-05 12:59:58 +1300 |
commit | 8571b74c829b8369eb7c11bb4cf7cbf52aa10d0b (patch) | |
tree | 7095d8edbb6531846326d8857595314dc3642c20 | |
parent | Exit child once done with printing (diff) | |
download | mpdlrc-8571b74c829b8369eb7c11bb4cf7cbf52aa10d0b.tar.gz mpdlrc-8571b74c829b8369eb7c11bb4cf7cbf52aa10d0b.zip |
Add mplrc-notify-send example
-rw-r--r-- | README.markdown | 5 | ||||
-rwxr-xr-x | mpdlrc-notify-send | 16 |
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) + |