#!/bin/bash

case $1 in
    mail)
        n=$(notmuch count -s inbox)
        [[ $n == 0 ]] &&
        echo  ||
        echo  $n
    ;;

    wifi)
        d=($(nmcli -t -f type dev))
        i=$(nmcli dev wifi | sed 1d | awk '/^\*/ { print $8 }')

        [[ $d == wifi ]] &&
        i=${i:-} || i=

        echo $i
    ;;

    weather)
        {
            curl -s wttr.in/spb?lang=ru | sed '7q; 1,2d' |
            sed 's/\x1b\[[0-9;]*m//g'
            date
        } > ${0%.*}.weather
        echo 
    ;;
esac
