diff options
author | Urbain Vaes <urbain@vaes.uk> | 2015-12-25 12:44:27 +0000 |
---|---|---|
committer | Urbain Vaes <urbain@vaes.uk> | 2015-12-25 12:44:27 +0000 |
commit | 0ea0d11d21de1234f1a5562b8b9e171d41896150 (patch) | |
tree | fc95023987a688595be298cd6ad49d3d69ae9b40 /.uzbl/scripts/url_from_surfraw.sh | |
parent | 1303e21f431bc49bba6dc275053d516da0392e54 (diff) |
Update uzbl config
Diffstat (limited to '.uzbl/scripts/url_from_surfraw.sh')
-rwxr-xr-x | .uzbl/scripts/url_from_surfraw.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/.uzbl/scripts/url_from_surfraw.sh b/.uzbl/scripts/url_from_surfraw.sh new file mode 100755 index 0000000..bf3c501 --- /dev/null +++ b/.uzbl/scripts/url_from_surfraw.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +DEFAULT_SEARCH=startpage +string=$1 +cmd=$2 +set -- $string +is_elvi=$(surfraw -elvi | grep -c "^$1\s") +nbr_words=$(echo "$string" | wc -w) +if [ "$nbr_words" -eq 1 ] && [ "$is_elvi" -eq 0 ] && ([[ "$string" == *.* ]] || [[ "$string" == *:* ]]) +then + url="$1" +elif [ $is_elvi -eq 1 ] +then + url="$(surfraw -print $string)" +else + url="$(surfraw -print $DEFAULT_SEARCH $string)" +fi +echo "$cmd $url" > $UZBL_FIFO |