dotfiles

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

notify (694B)


      1 #!/bin/sh
      2 # Cross-platform notification script.
      3 [ $# -ge 2 ] || { printf "Arguments: title, message\n" && exit 1; }
      4 group=${3:-$TERM}
      5 
      6 os=$(uname -s | tr '[:upper:]' '[:lower:]')
      7 case "$os" in
      8   linux*)
      9     # code for Linux
     10     if command -v notify-send >/dev/null 2>&1; then
     11       notify-send -c "$group" -u "${4:-normal}" "$1" "$2"
     12     fi
     13     ;;
     14   darwin*)
     15     if command -v terminal-notifier >/dev/null 2>&1; then
     16       terminal-notifier -title "$1" -message "$2" -activate io.alacritty -group "$group"
     17     else
     18       printf '\a'
     19     fi
     20     ;;
     21   msys*|cygwin*|mingw*|nt|win*)
     22     printf "Windows not supported.\n"
     23     ;;
     24   *)
     25     printf "Operating system %s is unknown.\n" "$os"
     26     ;;
     27 esac