dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 03ae926255c9094fc653d2d8ed61e8f3b51889ed
parent 78a380e86d7367c557e080476827c361cc04e99e
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Sun,  2 May 2021 11:13:35 +0200

notify: add notify-send

Diffstat:
Mscripts/notify | 28+++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/scripts/notify b/scripts/notify @@ -1,8 +1,26 @@ #!/bin/sh [ $# -ge 2 ] || { printf "Arguments: title, message\n" && exit 1; } group=${3:-$TERM} -if type terminal-notifier 1> /dev/null 2>&1; then - terminal-notifier -title "$1" -message "$2" -activate io.alacritty -group "$group" -else - printf '\a' -fi + +os=$(uname -s | tr '[:upper:]' '[:lower:]') +case "$os" in + linux*) + # code for Linux + if command -v notify-send >/dev/null 2>&1; then + notify-send -c "$group" -u "${4:-normal}" "$1" "$2" + fi + ;; + darwin*) + if command -v terminal-notifier >/dev/null 2>&1; then + terminal-notifier -title "$1" -message "$2" -activate io.alacritty -group "$group" + else + printf '\a' + fi + ;; + msys*|cygwin*|mingw*|nt|win*) + printf "Windows not supported.\n" + ;; + *) + printf "Operating system %s is unknown.\n" "$os" + ;; +esac