Skip to content

fix delete + add more keybinds #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 4, 2018
Merged
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
17 changes: 12 additions & 5 deletions buku_run
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ _rofi () {
switch_view="Alt+Tab"
new_bookmark="Alt+n"
actions="Alt+a"
edit="Alt+e"
delete="Alt+d"

# colors
help_color="#334433"
Expand Down Expand Up @@ -42,9 +44,9 @@ main () {
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}")
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}")
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}")
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}")
fi
val=$?
if [[ $val -eq 1 ]]; then
Expand All @@ -53,6 +55,10 @@ Use <span color='${help_color}'>${switch_view}</span> to switch View. <span colo
optionsMenu
elif [[ $val -eq 10 ]]; then
addMark
elif [[ $val -eq 14 ]]; then
deleteMenu
elif [[ $val -eq 13 ]]; then
editMenu
elif [[ $val -eq 11 ]]; then
if [[ $mode == "bookmarks" ]]; then
export mode="tags"
Expand Down Expand Up @@ -137,7 +143,7 @@ deleteMenu () {
exit
elif [[ $val -eq 0 ]]; then
if [[ $delask == "1. Yes" ]]; then
buku -d ${id}
buku -d ${id} --tacit
mode=bookmarks main
elif [[ $delask == "2. No" ]]; then
optionsMenu
Expand All @@ -149,7 +155,7 @@ editMenu () {
bookmark=$(echo "${menu}" | awk '{ print $2 }')
id=$(echo "${menu}" | awk '{ print $1 }')
tags=$(echo "${menu}" | awk '{ print substr($0, index($0,$3)) }' | sed 's/NOTAG//g')
content=$(echo -e "url: $bookmark\ntags: $tags")
content=$(echo -e "1. url: $bookmark\n2. tags: $tags")
editmenu=$(echo -e "< Return\n---\n${content}" | _rofi -p '> ')
val=$?
if [[ $val -eq 1 ]]; then
Expand Down Expand Up @@ -185,12 +191,13 @@ editBookmark () {
exit
elif [[ $val -eq 0 ]]; then
if [[ $bmarkmenu == "http"* ]]; then
buku -u "${id}" --url "${bookmark}"
buku -u "${id}" --url "${bmarkmenu}"
else
echo "" | rofi -e "Not a valid URI, Make sure URLs start with http"
editBookmark
fi
fi
mode=bookmarks main
}

addMark () {
Expand Down
2 changes: 2 additions & 0 deletions config.buku
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ _rofi () {
switch_view="Alt+Tab"
new_bookmark="Alt+n"
actions="Alt+a"
edit="Alt+e"
delete="Alt+d"

# colors
help_color="#2d7ed8"