File: insert_bookmark.sh

package info (click to toggle)
uzbl 0.0.0~git.20100403-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 760 kB
  • ctags: 783
  • sloc: ansic: 3,952; python: 3,082; sh: 353; makefile: 127
file content (18 lines) | stat: -rwxr-xr-x 719 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

[ -d "${XDG_DATA_HOME:-$HOME/.local/share}/uzbl" ] || exit 1
file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/bookmarks

which zenity &>/dev/null || exit 2
url=$6
# replace tabs, they are pointless in titles and we want to use tabs as delimiter.
title=$(echo "$7" | sed 's/\t/    /')
entry=`zenity --entry --text="Add bookmark. add tags after the '\t', separated by spaces" --entry-text="$url $title\t"`
exitstatus=$?
if [ $exitstatus -ne 0 ]; then exit $exitstatus; fi
url=`echo $entry | awk '{print $1}'`

# TODO: check if already exists, if so, and tags are different: ask if you want to replace tags
echo "$entry" >/dev/null #for some reason we need this.. don't ask me why
echo -e "$entry"  >> $file
true