blob: 428e24bbeab2193f99f09fd0abd6687ca0e21ac6 (
plain)
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
|
#!/bin/sh
. "lib_common.sh"
help() {
cat << EOF
${0}: Open links from bookmarks through dmenu
options:
[link] Open link
-h Print this message and exit
NOTE: bookmarks file is located at ~/.config/sites/bookmarks.txt
EOF
exit 0
}
[ -z "${BROWSER}" ] && BROWSER="firefox"
if [ "${#}" -eq 0 ]; then
bookmark_path="${XDG_CONFIG_HOME:-$HOME/.config}/sites/bookmarks.txt"
[ -e "${bookmark_path}" ] || err "Couldn't find bookmarks file"
. "lib_handle.sh"
link=$(< "${bookmark_path}" menu_handle center)
[ -z "${link}" ] || "${BROWSER}" "${link}"
fi
[ "${#}" -ne 1 ] && invalid_use
[ "${1}" = "-h" ] && help
"${BROWSER}" "${1}"
|