diff options
author | Thorsten Wißmann <edu@thorsten-wissmann.de> | 2011-10-01 22:55:23 +0200 |
---|---|---|
committer | Thorsten Wißmann <edu@thorsten-wissmann.de> | 2011-10-01 22:55:36 +0200 |
commit | 9d00b0d96b24b8a2c8c43803da6de4ee56f65ade (patch) | |
tree | ad926cdcde8a8f6bcdb153156c5da7c7964c3329 /scripts | |
parent | 2f3fb7749b1de6c2a153dffb93e9cbdb565d5b59 (diff) |
added herbstcommander.sh script
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/herbstcommander.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/herbstcommander.sh b/scripts/herbstcommander.sh new file mode 100755 index 00000000..3a99f294 --- /dev/null +++ b/scripts/herbstcommander.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# herbstcommander.sh - launch herbstluftwm-commands via dmenu +# Written by Florian Bruhin <me@the-compiler.org> + +config="$XDG_CONFIG_HOME/herbstluftwm/herbstcommander" +[[ -f "$config" ]] && source "$config" +dmenu_cmd=${dmenu_cmd:-dmenu} +herbstclient_cmd=${herbstclient_cmd:-herbstclient} +prompt=${prompt:-herbstluft: } +display_reply=${display_reply:-true} + +cmd=() + +while :; do + completion=$(herbstclient complete "${#cmd[@]}" "${cmd[@]}") + if [[ -z "$completion" ]]; then + echo "Executing ${cmd[@]}" + reply=$(herbstclient "${cmd[@]}") + status=$? + if [[ "$display_reply" && "$reply" ]]; then + dmenu -p "${cmd[*]}" <<< "$reply" >/dev/null + fi + exit $status + else + cmd+=( $(dmenu -p "herbstluft: ${cmd[@]}" <<< "$completion") ) + (( $? != 0 )) && exit 125 # dmenu was killed + fi +done |