be more friendly to people who have no XDG variables set + bitter checking and such
[uzbl-mobile] / examples / data / uzbl / 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 file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/bookmarks
6 [ -r "$file" ] || exit 
7 COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030"
8 if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]'
9 then
10         DMENU="dmenu -i -xs -rs -l 10" # vertical patch
11         # show tags as well
12         goto=`$DMENU $COLORS < $file | awk '{print $1}'`
13 else
14         DMENU="dmenu -i"
15         # because they are all after each other, just show the url, not their tags.
16         goto=`awk '{print $1}' $file | $DMENU $COLORS`
17 fi
18
19 #[ -n "$goto" ] && echo "uri $goto" > $4
20 [ -n "$goto" ] && uzblctrl -s $5 -c "uri $goto"