make icon setting configurable
[uzbl-mobile] / examples / scripts / insert_bookmark.sh
1 #!/bin/bash
2 # you probably want your bookmarks file in your $XDG_DATA_HOME ( eg $HOME/.local/share/uzbl/bookmarks)
3
4
5 [ -f /usr/share/uzbl/examples/data/bookmarks ] && file=/usr/share/uzbl/examples/data/bookmarks  # you will probably get permission denied errors here.
6 [ -f $XDG_DATA_HOME/uzbl/bookmarks           ] && file=$XDG_DATA_HOME/uzbl/bookmarks
7 [ -f ./examples/data/bookmarks               ] && file=./examples/data/bookmarks #useful when developing
8 [ -z "$file" ] && exit 1
9
10 which zenity &>/dev/null || exit 2
11
12 entry=`zenity --entry --text="Add bookmark. add tags after the '\t', separated by spaces" --entry-text="$6 $7\t"`
13 url=`awk '{print $1}' <<< $entry`
14 # TODO: check if already exists, if so, and tags are different: ask if you want to replace tags
15 echo "$entry" >/dev/null #for some reason we need this.. don't ask me why
16 echo -e "$entry"  >> $file
17 true