*nohtml*

local/bin/notify

   1 #!/bin/bash
   2 
   3 ln(){ # {{{
   4     s=$(cat)
   5     n=$(echo "$s" | wc -l)
   6 
   7     echo "$s" | {
   8         (( $n < 2 )) && cat ||
   9         head -n 9 | nl -w ${#n} -s '. '
  10     }
  11 
  12     (( $n > 9 )) && echo "$n. ..."
  13 } # }}}
  14 news(){ # {{{
  15     sqlite3 ~/.newsboat/cache.db '
  16         select title from rss_item
  17         where unread = 1 order by pubDate desc
  18     '
  19 } # }}}
  20 
  21 case $1 in
  22         days) notify-send -i x-office-calendar    Дни      -- "$(days             | ln)";;
  23         mail) notify-send -i emblem-mail          Почта    -- "$(frm -s new | tac | ln)";;
  24         news) notify-send -i application-rss+xml  Новости  -- "$(news             | ln)";;
  25      weather) notify-send -i ~/.cache/weather.svg Погода   -- "$(weather          | ln)";;
  26     torrents) notify-send -i transmission         Загрузки -- "$(torrents         | ln)";;
  27      battery) notify-send -i battery              Заряд    -- "$(battery          | ln)";;
  28       #music) notify-send -i audio-x-generic      Музыка   -- "$(music            | ln)";;
  29        music) music-notify;;
  30 
  31     '') grep -o '^\s\+\w\+)' $0 | tr -d ' )' | sort;;
  32      *) notify-send -i "$1" "${1^}" -- "$($* | ln)";;
  33 esac