aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/scripts/load_url_from_bookmarks.sh
blob: 2c2a9268e0800c7b0b04fdab0f858242c68e339f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

#NOTE: it's the job of the script that inserts bookmarks to make sure there are no dupes.

DMENU_SCHEME="bookmarks"

source $UZBL_UTIL_DIR/dmenu.sh
source $UZBL_UTIL_DIR/uzbl-args.sh
source $UZBL_UTIL_DIR/uzbl-dir.sh

[ -r "$UZBL_BOOKMARKS_FILE" ] || exit 1

if [ -z "$DMENU_HAS_VERTICAL" ]; then
    # because they are all after each other, just show the url, not their tags.
    goto=$(awk '{print $1}' $UZBL_BOOKMARKS_FILE | $DMENU)
else
    # show tags as well
    goto=$($DMENU < $UZBL_BOOKMARKS_FILE | awk '{print $1}')
fi

#[ -n "$goto" ] && echo "uri $goto" > $UZBL_FIFO
[ -n "$goto" ] && echo "uri $goto" | socat - unix-connect:$UZBL_SOCKET