*nohtml*

local/bin/status

   1 #!/bin/bash
   2 
   3 i='
   4 s/\s\+/\t/g
   5 s/[Dd]o.*\|Up.*/1 /
   6 s/Se.*/2 /
   7 s/[Qq]u.*\|st.*/3 /
   8 s/Id.*\|St.*\|pa.*/4 /
   9 '
  10 
  11 case ${1,,} in
  12        music) echo "$(music | tr \\n ' ')";;
  13      weather) weather -n | cut -d ' ' -f 1;;
  14         news) n=$(news | wc -l); echo $(icon $1) ${n%0};;
  15         mail) n=$(inbox | wc -l); n=${n%0}; echo $(icon $1-$n) $n;;
  16         days) n=$(days | grep -c '🎂'); [[ $n > 0 ]] && echo $(icon $1) $n;;
  17           os) source /etc/os-release; echo $(icon os) ${PRETTY_NAME:-$(uname -s)};;
  18     torrents) echo $(torrents | sed "$i" | sort -k 2 | uniq -cf 1 | awk '{ print $NF, $1 }');;
  19 
  20     '') grep -o '^\s\+\w\+)' $0 | tr -d ' )' | sort;;
  21 esac 2>&-