summaryrefslogtreecommitdiff
path: root/dmenu_omit
blob: d07d8f86ec8379e9e769ad2692c875a62c19390d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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