*nohtml*

local/bin/notify

   1 #!/bin/bash
   2 
   3 f=~/.cache/notify.svg
   4 r(){
   5     $* | {
   6         s=$(cat)
   7         n=$(echo "$s" | wc -l)
   8 
   9         echo "$s" | {
  10             (( n < 2 )) && cat ||
  11             head -n 9 | nl -w ${#n} -s '. '
  12         }
  13 
  14         (( n > 9 )) && echo "$n. ..."
  15     }
  16 
  17     source ~/.theme/colors.sh
  18     # test -f ~/.cache/$1.svg && cp $_ $f ||
  19     printf '<svg width="22" height="22"><text font-family="Nerdfont"
  20     y="18" font-size="20" fill="%s">%s</text></svg>' $foreground $(icon $1) > $f
  21 }
  22 mail(){ inbox; }
  23 
  24 if [[ $0 == *-notify ]]; then
  25     n=${0##*/} && notify ${n%-notify}
  26 else
  27     notify-send -i $f -a notify-$1 -- "${1^}" "$(r "$@")" &
  28 fi