add the functions needed for some keybindings
[zsh.git] / .zsh / functions / run
1 # -*- mode:sh -*-
2
3 # Run command in background and GUI notify when done
4 run () {
5 cmd=($argv[1] $argv[2,-1])
6 runit &
7 }
8
9 runit() {
10 printable=()
11 for piece in $cmd; do
12 if [[ -n "${piece//[^ ]/}" ]]; then
13 printable+=('"'"$piece"'"')
14 else
15 printable+=($piece)
16 fi
17 done
18 {
19 ${cmd}
20 } 2>&1 && notify-send "$printable" "done" || notify-send "$printable" "error $?" &
21 }
22
23 run "$@"