summaryrefslogtreecommitdiff
path: root/dmenu_omit
diff options
context:
space:
mode:
authorSteph Enders <smenders@gmail.com>2022-12-24 10:48:30 -0500
committerSteph Enders <steph@senders.io>2024-06-24 12:57:54 -0400
commiteba1b09b5b72806d90dc255f3dba1eb573fa9c08 (patch)
tree68ee670f9378d5e631b2510bca4d02e273f2350d /dmenu_omit
parent2b43dd013a22fc94519b70024f0ad1512d422848 (diff)
add patch: dmenu_omit - filter omitted entries
dmenu_omit is a filtering tool that appends any supplied entries to a list of items to filter from the dmenu result. This allows the user to remove troublesome items that exist in path, that need to exist in path, but are useless from dmenu. dmenu_omit is the command line tool to append these items to the list. dmenu_path was modified to filter based on the items in this list. dmenu_omitlist is the file stored in your configdir containing these files. Makefile was updated to install/uninstall the dmenu_omit
Diffstat (limited to 'dmenu_omit')
-rwxr-xr-xdmenu_omit22
1 files changed, 22 insertions, 0 deletions
diff --git a/dmenu_omit b/dmenu_omit
new file mode 100755
index 0000000..d07d8f8
--- /dev/null
+++ b/dmenu_omit
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+configdir="${XDG_CONFIG_HOME:-"$HOME/.config/dmenu"}"
+config="$configdir/dmenu_omitlist"
+
+[ ! -e "$configdir" ] && mkdir -p "$configdir"
+
+if [ $# -lt 1 ]; then
+ echo "Missing argument(s).
+ Usage: dmenu_omit item" >&2
+ exit 1
+fi
+
+for item in "$@"
+do
+ echo "$item" >> $config
+done
+
+# using grep to filter out any blanks or empty lines
+# useful if manually edited
+cat -s $config | grep -v -E '^([[:space:]])*$' | sort -u -o $config
+