]>
Commit | Line | Data |
---|---|---|
f29cd560 | 1 | #!/bin/sh |
2 | cmd=$(dmenu_path | ~/bin/dmenu "$@") | |
3 | if [ -n "$cmd" ]; then | |
de6b1600 | 4 | # NOTE: only tested with zsh and sh, and has issues with expansion; zsh |
a568f7fa | 5 | # SH_WORD_SPLIT is unset by default, `=' flag is required to expand it. |
6 | # XXX: probably has issues with single quotes | |
7 | # XXX: does not perform any(!) shell expansion | |
f29cd560 | 8 | echo "alias sudo='sudo -Ak' |
9 | cmd='$(echo "$cmd" | sed "s/'/'\\\\''/g")'" ' | |
10 | if [ -n "$ZSH_VERSION" ]; then | |
11 | out="$(${=cmd} 2>&1)" | |
12 | else | |
13 | out="$($cmd 2>&1)" | |
14 | fi | |
15 | code=$? | |
16 | out="$(echo "$out" | tail -n 3)" | |
17 | 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"} | |
18 | fi |