dotfiles

My collection of dotfiles
git clone git://git.noxz.tech/dotfiles
Log | Files | Refs

operations (806B)


      1 #!/bin/sh
      2 
      3 args="${@}"
      4 args="${args#$1}"
      5 args="${args#dmenu}"
      6 option="$([ "$1" = "-" ] && cat - || echo "$1")"
      7 
      8 case "$option" in
      9 list)
     10 	echo notify
     11 	echo sync-mail
     12 ;;
     13 notify)
     14 	text="$(
     15 		[ "$2" = "" ]                                           \
     16 		&& echo "$(echo -n | dmenu_vtc${args} -l 0 -p text:)"   \
     17 		|| echo "$2"
     18 	)"
     19 	if [ "$text" != "" ]; then
     20 		ztatus-notify "$text"
     21 	else
     22 		operations dmenu ${args}
     23 	fi
     24 ;;
     25 sync-mail)
     26 	"$HOME"/.local/bin/mbsync-stdin < "$XDG_CONFIG_HOME"/mbsync/template -a -V
     27 	for f in "$HOME"/mail/webmail-*/INBOX/new/*; do touch "$f" 2>/dev/null; done
     28 ;;
     29 dmenu|"")
     30 	option="$(operations list | dmenu_vtc${@#dmenu})"
     31 	if [ "$option" != "" ]; then
     32 		operations "$option" "${@#dmenu}"
     33 	else
     34 		exit 1
     35 	fi
     36 ;;
     37 *)
     38 	printf 'the operation "%s" is not implamented.\n' "$option"
     39 ;;
     40 esac