]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | cmd=$(dmenu_path | ~/bin/dmenu "$@") | |
3 | if [ -n "$cmd" ]; then | |
4 | # zsh SH_WORD_SPLIT is unset by default, `=' flag is required to expand | |
5 | echo "alias sudo='sudo -Ak' | |
6 | cmd='$(echo "$cmd" | sed "s/'/'\\\\''/g")'" ' | |
7 | if [ -n "$ZSH_VERSION" ]; then | |
8 | out="$(${=cmd} 2>&1)" | |
9 | else | |
10 | out="$($cmd 2>&1)" | |
11 | fi | |
12 | code=$? | |
13 | out="$(echo "$out" | tail -n 3)" | |
14 | notify-send -t 10000 -u $([ $code != 0 ] && echo normal || echo low) -a ' "'$(basename $0)'" ' "${cmd}$([ $code != 0 ] && echo \: $code)" "$out"' | SUDO_ASKPASS=~/bin/dpass ${SHELL:-"/bin/sh"} | |
15 | fi |