Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions buku_run
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ new_bookmark="Alt+n"
actions="Alt+a"
edit="Alt+e"
delete="Alt+d"
copyurl="Alt+l"

#libnotify messages
notifysend='true'
reverselist='false'

# colors
help_color="#334433"
Expand Down Expand Up @@ -43,10 +48,14 @@ main () {
HELP="Welcome to Buku. Use <span color='${help_color}'>${new_bookmark}</span> to add a new Bookmark
Use <span color='${help_color}'>${switch_view}</span> to switch View. <span color='${help_color}'>${actions}</span> for actions"
if [[ $mode == "bookmarks" ]]; then
content=$(buku -p -f 2 | awk 'NF == 2 { $0 = $0 "NOTAG" }; { $2 = substr($2,0,80); print $1"\t"$2"\t"$3,$4,$5 }' | column -t -s $'\t')
menu=$(echo "${content}" | _rofi -p '> ' -filter "${filter}" -mesg "${HELP}" -kb-custom-1 "${new_bookmark}" -kb-custom-2 "${switch_view}" -kb-custom-3 "${actions}" -kb-custom-4 "${edit}" -kb-custom-5 "${delete}")
if [[ $reverselist == "true" ]] ; then
content=$(buku -p -f 2 | grep -v 'waiting for input'| sort -V -r | awk 'NF == 2 { $0 = $0 "NOTAG" }; { $2 = substr($2,0,80); print $1"\t"$2"\t"$3,$4,$5 }' | column -t -s $'\t')
else
content=$(buku -p -f 2 | grep -v 'waiting for input'| awk 'NF == 2 { $0 = $0 "NOTAG" }; { $2 = substr($2,0,80); print $1"\t"$2"\t"$3,$4,$5 }' | column -t -s $'\t')
fi
menu=$(echo "${content}" | _rofi -p '> ' -filter "${filter}" -mesg "${HELP}" -kb-custom-1 "${new_bookmark}" -kb-custom-2 "${switch_view}" -kb-custom-3 "${actions}" -kb-custom-4 "${edit}" -kb-custom-5 "${delete}" -kb-custom-6 "${copyurl}")
elif [[ $mode == "tags" ]]; then
menu=$(buku --np --st | awk '{$NF=""; print $0}' | cut -d ' ' -f2- | _rofi -p '> ' -mesg "${HELP}" -kb-custom-1 "${new_bookmark}" -kb-custom-2 "${switch_view}" -kb-custom-3 "${actions}" -kb-custom-4 "${edit}" -kb-custom-5 "${delete}")
menu=$(buku --np --st | awk '{$NF=""; print $0}' | cut -d ' ' -f2- | _rofi -p '> ' -mesg "${HELP}" -kb-custom-1 "${new_bookmark}" -kb-custom-2 "${switch_view}" -kb-custom-3 "${actions}" -kb-custom-4 "${edit}" -kb-custom-5 "${delete}" -kb-custom-6 "${copyurl}")
fi
val=$?
if [[ $val -eq 1 ]]; then
Expand All @@ -59,6 +68,12 @@ Use <span color='${help_color}'>${switch_view}</span> to switch View. <span colo
deleteMenu
elif [[ $val -eq 13 ]]; then
editMenu
elif [[ $val -eq 15 ]]; then
url=$(echo "${menu}" | awk '{ print $2 }')
echo "${url}" | xclip -selection clipboard
if [[ $notifysend == "true" ]] ; then
notify-send "Copied ${url}"
fi
elif [[ $val -eq 11 ]]; then
if [[ $mode == "bookmarks" ]]; then
export mode="tags"
Expand All @@ -71,6 +86,10 @@ Use <span color='${help_color}'>${switch_view}</span> to switch View. <span colo
if [[ $mode == "bookmarks" ]]; then
id=$(echo "${menu%% *}")
for bm in ${id}; do
if [[ $notifysend == "true" ]] ; then
url=$(echo "${menu}" | awk '{ print $2 }')
notify-send "Opening ${url}"
fi
buku -o "${bm}"
done
elif [[ $mode == "tags" ]]; then
Expand Down
6 changes: 6 additions & 0 deletions config.buku
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ new_bookmark="Alt+n"
actions="Alt+a"
edit="Alt+e"
delete="Alt+d"
copyurl="Alt+l"

#libnotify messages
notifysend='true'
#display oldest bookmarks on top by default
reverselist='false'

# colors
help_color="#2d7ed8"