-
Notifications
You must be signed in to change notification settings - Fork 0
/
dmbook
executable file
·30 lines (22 loc) · 1.08 KB
/
dmbook
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
#!/bin/env bash
BMFILE="$HOME/.config/qutebrowser/bookmarks/urls"
QMFILE="$HOME/.config/qutebrowser/quickmarks"
HFILE="$HOME/.local/share/qutebrowser/history.sqlite"
SEPERATOR="-----------------------------------------------------------------------------------"
readarray -t bmarks < "$BMFILE"
readarray -t qmarks < "$QMFILE"
bmlist=$(printf '%s\n' "${bmarks[@]}" | awk '{print $2" - "$1}')
qmlist=$(printf '%s\n' "${qmarks[@]}" | awk '{print "["$1"] - "$NF}' | sort)
SQL="SELECT h.title, h.url FROM history as h where url like 'http%';"
histlist=$(printf '%s\n' "$(sqlite3 "$HFILE" "${SQL}")" | awk -F "|" '{print $1" - "$NF}')
choice=$(printf '%s\n' "$qmlist" "$SEPERATOR" "$bmlist" "$SEPERATOR" "$histlist" | dmenu -i -l 20 -p 'Bookmarks and history:')
#[[ "$choice" == "$SEPERATOR" ]] && qutebrowser
#[[ ! "$choice" == "$SEPERATOR" ]] && ( url=$(echo "${choice}" | awk '{print $NF}') || exit; qutebrowser "$url" )
if [ "$choice" == "$SEPERATOR" ]; then
qutebrowser
elif [ "$choice" ]; then
url=$(echo "${choice}" | awk '{print $NF}') || exit
qutebrowser "$url"
else
exit 0
fi