summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2015-09-15 09:31:07 +0100
committerUrbain Vaes <urbain@vaes.uk>2015-09-15 09:31:07 +0100
commit9b7c7320d7926c4d8aaa8b68bb677114b292aa6a (patch)
tree084b036f431a5d46b32135d3087fee1227eba3ce
parente69db5463391625880576eb895ca5d761bfaad54 (diff)
Improve uzbl configuration
-rw-r--r--.uzbl/bookmarks2
-rw-r--r--.uzbl/config2
-rwxr-xr-x.uzbl/scripts/load_url_from_surfraw.sh57
-rw-r--r--.uzbl/style.css2
4 files changed, 61 insertions, 2 deletions
diff --git a/.uzbl/bookmarks b/.uzbl/bookmarks
index c1de50b..d2e8de3 100644
--- a/.uzbl/bookmarks
+++ b/.uzbl/bookmarks
@@ -10,3 +10,5 @@ https://www.facebook.com/ Facebook
https://translate.google.co.uk/ Translate
https://mail.google.com/mail/u/1/#inbox Gmail
https://www.linkedin.com/ Linked In
+https://news.ycombinator.com/ Hackernews
+https://stallman.org/ Richard Stallman
diff --git a/.uzbl/config b/.uzbl/config
index d35c547..7e3eb23 100644
--- a/.uzbl/config
+++ b/.uzbl/config
@@ -486,7 +486,7 @@ bind 'weather _ = sh 'surfraw -g $8 %s' weather
@cbind gu = spawn @scripts_dir/test.sh
@cbind gU = spawn @scripts_dir/mytest.sh
@cbind ytdl = sh '$HOME/dotfiles/.uzbl/scripts/ytdl.sh "$UZBL_URI"'
-# @bind o = sh 'uri=`$HOME/dotfiles/.uzbl/scripts/load_url_from_surfraw.sh` && echo "uri $uri" > $4'
+@bind o = sh 'uri=`$HOME/dotfiles/.uzbl/scripts/load_url_from_surfraw.sh` && echo "uri $uri" > "$UZBL_FIFO"'
# @cbind t = sh 'uri=`$HOME/dotfiles/.uzbl/scripts/load_url_from_surfraw.sh` && echo "event REQ_NEW_WINDOW $uri" > "$UZBL_FIFO"'
@on_event DOWNLOAD_COMPLETE spawn @scripts_dir/downloadviewer.sh %s
diff --git a/.uzbl/scripts/load_url_from_surfraw.sh b/.uzbl/scripts/load_url_from_surfraw.sh
new file mode 100755
index 0000000..641ca3c
--- /dev/null
+++ b/.uzbl/scripts/load_url_from_surfraw.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+# Default search engine. If we really are at a loss, use this
+DEFAULT_SEARCH=google
+
+# The location of the surfraw bookmark file
+BOOKMARKS="$HOME/.surfraw.bookmarks"
+
+# Colors for dmenu
+COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030"
+
+# Prompt for dmenu
+PROMPT="Open"
+
+# Use surfraw to search for the words
+function search()
+{
+ # Does surfraw know what to do with it?
+ url=`surfraw -print $@`
+
+ # If not, then use the default search engine
+ if [ $? -ne 0 ]
+ then
+ url=`surfraw -print $DEFAULT_SEARCH $@`
+ fi
+
+ echo $url
+}
+
+# We assume that this is a URL
+function goto()
+{
+ case "$1" in
+ *:*) echo $1 ;;
+ *) echo "http://$1" ;;
+ esac
+}
+
+# Use dmenu to navigate through possible choices
+function present_menu()
+{
+ elvi=`surfraw -elvi | cut -f 1 | tail --lines=+2`
+ if [ -r "$BOOKMARKS" ]
+ then
+ bookmarks=" `cut -f 1 -d ' ' "$BOOKMARKS" 2>/dev/null`"
+ else
+ bookmarks=""
+ fi
+
+ echo "${elvi}${bookmarks}" | tr ' ' '\n' | sort | dmenu -p "$PROMPT" -i $COLORS
+}
+
+present_menu | \
+ ( read car cdr
+test -z "$car" && exit 1
+( test -z "$cdr" && echo $car | fgrep -c '.
+:' > /dev/null && goto $car ) || search "$car $cdr" )
diff --git a/.uzbl/style.css b/.uzbl/style.css
index a5fe457..bf769c8 100644
--- a/.uzbl/style.css
+++ b/.uzbl/style.css
@@ -14,7 +14,7 @@
text-transform: uppercase;
-webkit-transform: translate(-3px,-1px);
- opacity: 0.8;
+ opacity: 1.0;
-webkit-border-radius: 6px !important;
/* Play around with this, pretty fun things to do :) */
/* -webkit-transform: scale(1) rotate(0deg) translate(-6px,-5px) !important; */