reorganize/refactor example scripts/config / bookmark file etc so that its easier...
authorDieter Plaetinck <dieter@plaetinck.be>
Mon, 27 Apr 2009 19:25:35 +0000 (21:25 +0200)
committerDieter Plaetinck <dieter@plaetinck.be>
Mon, 27 Apr 2009 19:25:35 +0000 (21:25 +0200)
Makefile
examples/bookmarks [new file with mode: 0644]
examples/configs/sampleconfig [new file with mode: 0644]
examples/configs/sampleconfig-dev [new file with mode: 0644]
examples/scripts/download.sh [new file with mode: 0755]
examples/scripts/history.sh [new file with mode: 0755]
examples/scripts/insert_bookmark.sh [new file with mode: 0755]
examples/scripts/load_url_from_bookmarks.sh [new file with mode: 0755]
examples/scripts/load_url_from_history.sh [new file with mode: 0755]

index af8c8e5..97f5761 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,15 +5,19 @@ all: uzbl
 test:
        ./uzbl --uri http://www.uzbl.org
 
+test-config:
+       ./uzbl --uri http://www.uzbl.org --config examples/configs/sampleconfig-dev
+
+test-config-real:
+       ./uzbl --uri http://www.uzbl.org --config /usr/share/uzbl/examples/configs/sampleconfig
+       
 clean:
        rm -f uzbl
 
 install:
        install -d $(DESTDIR)/usr/bin
        install -d $(DESTDIR)/usr/share/uzbl/docs
-       install -d $(DESTDIR)/usr/share/uzbl/examples/scripts
-       install -d $(DESTDIR)/usr/share/uzbl/examples/configs
+       install -d $(DESTDIR)/usr/share/uzbl/examples
        install -D -m755 uzbl $(DESTDIR)/usr/bin/uzbl
-       install -D -m644 extra/* $(DESTDIR)/usr/share/uzbl/examples/scripts
-       install -D -m644 sampleconfig $(DESTDIR)/usr/share/uzbl/examples/configs
+       cp -ax examples $(DESTDIR)/usr/share/uzbl/
        install -D -m644 README $(DESTDIR)/usr/share/uzbl/docs
diff --git a/examples/bookmarks b/examples/bookmarks
new file mode 100644 (file)
index 0000000..13fcd48
--- /dev/null
@@ -0,0 +1,4 @@
+http://www.archlinux.org linux arch
+http://www.uzbl.org uzbl browser
+http://dieter.plaetinck.be uzbl
+http://www.icanhascheezburger.com lolcats fun
diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig
new file mode 100644 (file)
index 0000000..b92acc2
--- /dev/null
@@ -0,0 +1,41 @@
+
+# example uzbl config. in a real config, we should obey the xdg spec
+
+# all keys in the behavior group are optional.  if not set, the corresponding behavior is disabed.
+# bindings_internal denote keys to trigger actions internally in uzbl
+# bindings_external denote keys to trigger scripts outside uzbl
+
+# keyboard behavior is vimstyle by default (all actions -> 1 key). set
+# always_insert_mode to always be in insert mode and disable going out of it.
+# if you do this, make sure you've set a modkey so you can reach the actions
+# from insert mode by combining them with the modkey
+
+[behavior]
+history_handler = /bin/bash /usr/share/uzbl/examples/scripts/history.sh
+download_handler = /bin/bash /usr/share/uzbl/examples/scripts/download.sh
+fifo_dir = /tmp
+always_insert_mode = 0
+modkey = Mod1
+show_status = 1
+status_top = 0
+
+[bindings_internal]
+back = b
+forward = m
+stop = s
+refresh = r
+reload = R
+home = h
+follow_link_here = f
+follow_link_new_tab = F
+follow_link_new_window = w
+zoom_in = +
+zoom_out = -
+toggle_status = t
+
+[bindings_external]
+/bin/bash /usr/share/uzbl/examples/scripts/insert_bookmark.sh = B
+/bin/bash /usr/share/uzbl/examples/scripts/load_url_from_history.sh = u
+/bin/bash /usr/share/uzbl/examples/scripts/load_url_from_bookmarks.sh = U
+
+[network]
diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev
new file mode 100644 (file)
index 0000000..f7f3bb7
--- /dev/null
@@ -0,0 +1,41 @@
+
+# example uzbl config. in a real config, we should obey the xdg spec
+
+# all keys in the behavior group are optional.  if not set, the corresponding behavior is disabed.
+# bindings_internal denote keys to trigger actions internally in uzbl
+# bindings_external denote keys to trigger scripts outside uzbl
+
+# keyboard behavior is vimstyle by default (all actions -> 1 key). set
+# always_insert_mode to always be in insert mode and disable going out of it.
+# if you do this, make sure you've set a modkey so you can reach the actions
+# from insert mode by combining them with the modkey
+
+[behavior]
+history_handler = /bin/bash ./examples/scripts/history.sh
+download_handler = /bin/bash ./examples/scripts/download.sh
+fifo_dir = /tmp
+always_insert_mode = 0
+modkey = Mod1
+show_status = 1
+status_top = 0
+
+[bindings_internal]
+back = b
+forward = m
+stop = s
+refresh = r
+reload = R
+home = h
+follow_link_here = f
+follow_link_new_tab = F
+follow_link_new_window = w
+zoom_in = +
+zoom_out = -
+toggle_status = t
+
+[bindings_external]
+/bin/bash ./examples/scripts/insert_bookmark.sh = B
+/bin/bash ./examples/scripts/load_url_from_history.sh = u
+/bin/bash ./examples/scripts/load_url_from_bookmarks.sh = U
+
+[network]
diff --git a/examples/scripts/download.sh b/examples/scripts/download.sh
new file mode 100755 (executable)
index 0000000..ff3d8db
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+wget $5
diff --git a/examples/scripts/history.sh b/examples/scripts/history.sh
new file mode 100755 (executable)
index 0000000..03c568a
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+#TODO: strip 'http://' part
+# you probably really want this in your $XDG_DATA_HOME (eg $HOME/.local/share/uzbl/history)
+echo "$7 $5" >> /tmp/uzbl.history
diff --git a/examples/scripts/insert_bookmark.sh b/examples/scripts/insert_bookmark.sh
new file mode 100755 (executable)
index 0000000..af6ca8a
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+# you probably want your bookmarks file in your $XDG_DATA_HOME ( eg $HOME/.local/share/uzbl/bookmarks)
+if [ -f /usr/share/uzbl/examples/bookmarks ]
+then
+       file=/usr/share/uzbl/examples/bookmarks
+else
+       file=./examples/bookmarks #useful when developing
+fi
+
+which zenity &>/dev/null || exit 2
+
+entry=`zenity --entry --text="Add bookmark. add tags at the end, separated by commas" --entry-text="$5"`
+url=`awk '{print $1}' <<< $entry`
+# TODO: check if already exists, if so, and tags are different: ask if you want to replace tags
+echo "$entry" >> $file
diff --git a/examples/scripts/load_url_from_bookmarks.sh b/examples/scripts/load_url_from_bookmarks.sh
new file mode 100755 (executable)
index 0000000..fd9179e
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# you probably want your bookmarks file in your $XDG_DATA_HOME ( eg $HOME/.local/share/uzbl/bookmarks)
+if [ -f /usr/share/uzbl/examples/bookmarks ]
+then
+        file=/usr/share/uzbl/examples/bookmarks
+else
+        file=./examples/bookmarks #useful when developing
+fi
+
+goto=`awk '{print $1}' $history_file | dmenu` #NOTE: it's the job of the script that inserts bookmarks to make sure there are no dupes.
+[ -n "$goto" ] && echo "uri $goto" > $4
diff --git a/examples/scripts/load_url_from_history.sh b/examples/scripts/load_url_from_history.sh
new file mode 100755 (executable)
index 0000000..366aedf
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+# you probably really want this in your $XDG_DATA_HOME (eg $HOME/.local/share/uzbl/history)
+history_file=/tmp/uzbl.history
+
+goto=`awk '{print $3}' $history_file | sort | uniq | dmenu`
+[ -n "$goto" ] && echo "uri $goto" > $4