commit 46f3a2cfe06fba98d15a35b9f04d9c9b36711321
parent c7f1c9d7cfc1bd905b8826a095c05dc96ac4bb7b
Author: prx <prx@ybad.name>
Date: Mon, 19 Aug 2019 09:54:33 +0200
Add dmenu_run_i script to start a command in term if input ends with !
Diffstat:
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/tools.suckless.org/dmenu/scripts/dmenu_run_i b/tools.suckless.org/dmenu/scripts/dmenu_run_i
@@ -0,0 +1,14 @@
+#!/bin/sh
+# dmenu_run improved
+# if a command ends with "!", it is started in term.
+
+termcmd="st -e"
+test -s $HOME/.dmenurc && . $HOME/.dmenurc
+
+cmd="$(dmenu_path | dmenu $@)"
+case $cmd in
+ *\! ) ${termcmd} "$(printf "%s" "${cmd}" | cut -d'!' -f1)";;
+ * ) ${cmd} ;;
+esac
+exit
+
diff --git a/tools.suckless.org/dmenu/scripts/index.md b/tools.suckless.org/dmenu/scripts/index.md
@@ -32,3 +32,5 @@ Download
remove it.
* [via](https://github.com/xalexalex/via): simple dmenu-based launcher for apps,
files, folders and shell commands
+* [dmenu_run_i](./dmenu_run_i): When dmenu_path input end with "!", the
+command is started in a terminal. i.e. "top!".