forked from Nokorot/dotbin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdml
More file actions
executable file
·48 lines (32 loc) · 879 Bytes
/
Copy pathdml
File metadata and controls
executable file
·48 lines (32 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
source ~/.uservars
# TODO bmdir="$HOME/.config/dmenu_run.wlist.d"
# brfile="$HOME/.config/gg-bookmarks"
bmfile="$HOME/.config/dml/main"
run() {
[ -z $1 ] && exit
l=$(_dml_cmp $bmfile | grep "^$1$\|^$1 ")
[ -z "$l" ] && notify-send "keyword '$1' was not found"
c=$(echo $l | cut -d' ' -f2- )
[ -z "$c" ] && c=$1
echo $c
echo $c | ${SHELL:-"/bin/sh"} &
}
dmenu_search() {
_dml_cmp $bmfile | \
cut -d' ' -f1 | dmenu -i -p "$prompt"
}
usage() {
echo "Usage: $0 [-c <file>] <choose>\\n -c: dml-file, default '$bmfile' \\n" 1>&2; exit 1;}
while getopts "hc:p:" o; do case "${o}" in
c) bmfile=$OPTARG ;;
p) prompt=$OPTARG ;;
*) usage && exit ;;
esac done
shift $((OPTIND-1))
if [ -z $1 ]; then
run $(dmenu_search)
else
run "$1"
fi
# < ~/.config/dmenu_run.wlist dmenu "$@" | ${SHELL:-"/bin/sh"} &