summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThorsten Wißmann <edu@thorsten-wissmann.de>2011-08-26 02:51:51 +0200
committerThorsten Wißmann <edu@thorsten-wissmann.de>2011-08-26 02:51:51 +0200
commitc88c3f85f99adc763420a133be45e98077f7972d (patch)
tree219620864b6c79321331afa8c7b39a8dd3b7445a /scripts
parent9d43750eeab0d83757dfcad2c9689f64cfa216b2 (diff)
added a dmenu script
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dmenu.sh24
-rwxr-xr-xscripts/execwith.sh10
2 files changed, 34 insertions, 0 deletions
diff --git a/scripts/dmenu.sh b/scripts/dmenu.sh
new file mode 100755
index 00000000..b103cd69
--- /dev/null
+++ b/scripts/dmenu.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+dmenu_command=${dmenu_command:-dmenu}
+hc=${herbstclient_command:-herbstclient}
+
+dmenu_cmd() {
+ $dmenu_command "$@"
+}
+
+simple_command() {
+ arg=$($hc complete 1 "$@"|dmenu_cmd -p "$@:") \
+ && exec $hc "$@" "$arg"
+}
+
+case "$1" in
+ use) simple_command "$1" ;;
+ *)
+ echo "unknown menu $1" >&2
+ ;;
+esac
+
+
+
+
diff --git a/scripts/execwith.sh b/scripts/execwith.sh
new file mode 100755
index 00000000..ca6564c5
--- /dev/null
+++ b/scripts/execwith.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# exec a script $2... with settings from rc-file $1
+# useful for various dmenu scripts, e.g.:
+# ./execwith.sh ~/.bash_settings ./dmenu.sh use
+
+source "$1"
+shift
+exec "$@"
+