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

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

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

FOO=$(buku --np --nc -p -1)
OUT="$(buku --np --nc -a "$url" "$tags" 2>&1)"
#echo "OUT>$OUT"
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 --np --nc -p -1)
    #echo "BAR>$BAR"
done;

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

exit 0