dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 149c1722ba1dbb5268cd35fbaffa45822d70ab19
parent 8076106d7c158a9e12315ea252159467c2ed0fd4
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Thu, 25 Jun 2020 09:51:23 +0200

Use xmessage as fallback if notify-send is not available

Diffstat:
M.local/bin/notify | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/.local/bin/notify b/.local/bin/notify @@ -1,12 +1,17 @@ #!/bin/sh +prog=notify-send if ! command -v notify-send >/dev/null 2>&1; then - echo >&2 'error: notify-send not installed' - exit 1 + if ! command -v xmessage >/dev/null 2>&1; then + printf '%s error: notify-send or xmessage not available' "${0##*/}" >&2 + exit 1 + else + prog=xmessage + fi fi if [ $# -eq 0 ]; then - notify-send "$(cat)" + $prog "$(cat)" else - notify-send "$@" + $prog "$@" fi