21ea33d51b2e7019b148868f0e3a163e1c0d32c0
[uzbl-mobile] / examples / scripts / load_url_from_bookmarks.sh
1 #!/bin/bash
2
3 #NOTE: it's the job of the script that inserts bookmarks to make sure there are no dupes.
4
5 [ -f /usr/share/uzbl/examples/data/bookmarks ] && file=/usr/share/uzbl/examples/data/bookmarks
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 COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030"
10 if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]'
11 then
12         DMENU="dmenu -i -xs -rs -l 10" # vertical patch
13         # show tags as well
14         goto=`$DMENU $COLORS < $file | awk '{print $1}'`
15 else
16         DMENU="dmenu -i"
17         # because they are all after each other, just show the url, not their tags.
18         goto=`awk '{print $1}' $file | $DMENU $COLORS`
19 fi
20
21 #[ -n "$goto" ] && echo "act uri $goto" > $4
22 [ -n "$goto" ] && uzblctrl -s $5 -c "act uri $goto"