blob: 1ec34a7abca85778b13344447b9e13bb7e2d1cbc (
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
30
31
32
33
|
#!/bin/bash
SESH=$(loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p Type | awk -F= '{print $2}')
if [[ "$SESH" = "wayland" ]]; then
url=$(wl-paste)
tags=$(yad --entry --text="enter tags for $url")
else
url=$(xsel -b)
tags=$(zenity --entry --text="enter tags for $url")
fi
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
|