summaryrefslogtreecommitdiffstats
path: root/.local/bin/bukuadd_c
blob: 86f705d9b568d6f963eb588d05db947da3917545 (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
#!/bin/bash

#set -e
url=$(xsel -b)
tags=$(zenity --entry --text="enter tags for $url")

if [[ $? -ne 0 ]]; then
    exit 0
fi

FOO=$(buku --nostdin --np --nc -p -1)
OUT="$(buku --nostdin --np --nc -a "$url" "$tags" 2>&1)"
if [[ $OUT =~ "ERROR" ]]; then
    notify-send "Bookmarking Failed" "$OUT" --app-name="buku" --icon="dialog-error"
    exit 1
fi

BAR=$FOO

while [[ $BAR == "$FOO" ]]; do
    sleep 1
    BAR=$(buku --nostdin --np --nc -p -1)
done

notify-send "Success" "$BAR" --app-name="buku" --icon="checkmark"

exit 0