aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Tom Adams <tom@holizz.com>2009-06-09 12:19:17 +0100
committerGravatar Tom Adams <tom@holizz.com>2009-06-09 12:19:17 +0100
commit9ade752203fba5f1bbfdf5846f7a1203e2da348e (patch)
treea64fbd7934bc10fae16a1b3067fe0ba727af8774
parente2c28f58b68ff82fc25ead769cda5b5469d24fe2 (diff)
parentddcec48929b6ab18bc6a6324d2d5919b081f48a4 (diff)
Merge commit 'Dieterbe/experimental' into experimental
-rw-r--r--AUTHORS1
-rw-r--r--README2
-rw-r--r--docs/FAQ14
-rw-r--r--examples/config/uzbl/config42
-rwxr-xr-xexamples/data/uzbl/scripts/cookies.py7
-rwxr-xr-xexamples/data/uzbl/scripts/cookies.sh5
-rwxr-xr-xexamples/data/uzbl/scripts/formfiller.pl2
-rwxr-xr-xexamples/data/uzbl/scripts/formfiller.sh5
-rwxr-xr-xexamples/data/uzbl/scripts/history.sh4
-rwxr-xr-xexamples/data/uzbl/scripts/insert_bookmark.sh5
-rwxr-xr-xexamples/data/uzbl/scripts/load_url_from_bookmarks.sh4
-rwxr-xr-xexamples/data/uzbl/scripts/load_url_from_history.sh3
-rwxr-xr-xexamples/data/uzbl/scripts/session.sh5
-rw-r--r--uzbl.c9
-rw-r--r--uzbl.h3
15 files changed, 75 insertions, 36 deletions
diff --git a/AUTHORS b/AUTHORS
index 83b87a1..1253144 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -25,6 +25,7 @@ Contributors:
neutralinsomniac - load_progress = 0 fix
Maximilian Gaß (mxey) - small patches
Abel Camarillo (00z) - make it compile on OpenBSD
+ (israellevin) - toggle_zoom_type
Originaly based on http://trac.webkit.org/browser/trunk/WebKitTools/GtkLauncher/main.c
Which is copyrighted:
diff --git a/README b/README
index 4740b21..aea62ce 100644
--- a/README
+++ b/README
@@ -7,7 +7,7 @@
### TO NEW PEOPLE:
* please read the documentation in /usr/share/uzbl/docs
* invoke uzbl --help
-* to get you started: uzbl --uri 'http://www.archlinux.org' --config /usr/share/uzbl/examples/configs/sampleconfig
+* to get you started: `XDG_DATA_HOME=/usr/share/uzbl/examples/data XDG_CONFIG_HOME=/usr/share/uzbl/examples/config uzbl --uri www.archlinux.org`
* study the sample config, have a look at all the bindings, and note how you can call the scripts to load new url from history and the bookmarks file
* note that there is no url bar. all url editing is supposed to happen _outside_ of uzbl.
For now, you can use the `load_from_*` dmenu based scripts to pick a url or type a new one or write commands into the fifo (see /usr/share/uzbl/docs/CHECKLIST)
diff --git a/docs/FAQ b/docs/FAQ
index ef5df5f..b377607 100644
--- a/docs/FAQ
+++ b/docs/FAQ
@@ -4,11 +4,15 @@ FAQ
### I just installed uzbl but it doesn't do much. What now?
Uzbl includes very limited default settings (statusbar settings, but no keybinds, history/download handlers etc.)
Look at /usr/share/uzbl/docs/config.h to see the default settings.
-Neither does uzbl create a default config file on startup like some other programs do.
-Because we want to give you the freedom to place your config where you want, and to use a config or not.
-Have a look in /usr/share/uzbl/examples/configs to see what you can do. You will probably want to create your own config based on an example config
-so you can add keybinds and to use scripts.
-Use the --config parameter or save your config as $XDG\_CONFIG\_HOME/uzbl/config to have it auto-loaded.
+Neither does uzbl create a default config file on startup like some other programs do because we want to give you the freedom to place your config where you want, and to use a config or not.
+Have a look in /usr/share/uzbl/examples/configs to see what you can do.
+If you save a config as $XDG\_CONFIG\_HOME/uzbl/config it will be loaded automatically.
+Running with the `--verbose` flag on a command line can also be interesting.
+To get you started, try this:
+`XDG_DATA_HOME=/usr/share/uzbl/examples/data XDG_CONFIG_HOME=/usr/share/uzbl/examples/config uzbl`
+It will temporarily override your $XDG\_CONFIG\_HOME and $XDG\_DATA\_HOME
+variables so you can try the sample stuff directly in /usr/share/uzbl/examples.
+If you like what you can do, you can copy the sample stuff into your ~ and edit to your liking.
### Where is the location bar? How do I change the URL ?
Uzbl has no location bar. All changes to the uri (editing of current uri, typing new uri, loading of uri from bookmarks/history/...) happens *outside* of uzbl.
diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config
index bbe3a75..e7c03dc 100644
--- a/examples/config/uzbl/config
+++ b/examples/config/uzbl/config
@@ -1,18 +1,22 @@
-
-# example uzbl config. in a real config, we should obey the xdg spec
+# example uzbl config.
# all settings are optional. you can use uzbl without any config at all (but it won't do much)
-# keyboard behavior is vimstyle by default (all commands -> 1 key). set
-# always_insert_mode to always be in insert mode and disable going out of it.
+# keyboard behavior is vimstyle by default, but you can change this
+# 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 commands
# from insert mode by combining them with the modkey
-# TODO: ability to attach misc things (spawn <foo>, script <bar>,.. to internal events)
# Usually you want to spawn a script to handle things, but any command (such as sh) can be used
set history_handler = spawn $XDG_DATA_HOME/uzbl/scripts/history.sh
set download_handler = spawn $XDG_DATA_HOME/uzbl/scripts/download.sh
set cookie_handler = spawn $XDG_DATA_HOME/uzbl/scripts/cookies.py
+# You can bind whatever things (spawn <foo>, script <bar>,..) to some events TODO: make events system more generic
+set load_start_handler = set status_message = <span foreground="khaki">wait</span>
+set load_commit_handler = set status_message = <span foreground="green">recv</span>
+set load_finish_handler = set status_message = <span foreground="gold">done</span>
+
+
set minimum_font_size = 6
set font_size = 11
## monospace_size defaults to font_size, but you can alter it independently
@@ -61,7 +65,7 @@ set show_status = 1
# you can optionally use this setting to override the background color of the statusbar from your GTK theme.
set status_background = #303030
set status_format = <span font_family="monospace"><span background="khaki" foreground="black">[MODE]</span> [<span weight="bold" foreground="red">KEYCMD</span>] <span foreground="#606060"> LOAD_PROGRESSBAR </span><span foreground="#99FF66">URI</span> <span foreground="khaki">NAME</span> <span foreground="orange">MSG</span><span foreground="#606060">SELECTED_URI</span></span>
-set status_top = 0
+set status_top = 0
# define how your titlebar should look like. (short = statusbar is also shown, long = show everything you must see if statusbar is off)
set title_format_short = TITLE - Uzbl browser <NAME>
set title_format_long = KEYCMD MODE TITLE - Uzbl browser <NAME> > SELECTED_URI
@@ -99,11 +103,12 @@ bind << = scroll_begin
bind >> = scroll_end
bind b = back
bind m = forward
-bind s = stop
+bind S = stop
bind r = reload
bind R = reload_ign_cache
bind + = zoom_in
bind - = zoom_out
+bind T = toggle_zoom_type
bind 1 = sh "echo set zoom_level = 1.0 > $4"
bind 2 = sh "echo set zoom_level = 2.0 > $4"
bind t = toggle_status
@@ -115,9 +120,15 @@ bind ?* = search_reverse %s
bind n = search
bind N = search_reverse
bind gh = uri http://www.uzbl.org
-#TODO: set uri?
+
+# like this you can enter any command at runtime, interactively. prefixed by ':'
+bind :_ = chain '%s'
+
+# shortcut to set the uri. TODO: i think we can abandon the uri command in favor of 'set uri = ..'
bind o _ = uri %s
-bind :wiki _ = uri http://wiki.archlinux.org/index.php/Special:Search?search=%s&go=Go
+# shortcut to set variables
+bind s _ = set %s
+bind \wiki _ = uri http://wiki.archlinux.org/index.php/Special:Search?search=%s&go=Go
bind gg _ = uri http://www.google.com/search?q=%s
bind i = toggle_insert_mode
# disable insert mode (1 to enable). note that Esc works to disable, regardless of this setting
@@ -133,11 +144,13 @@ bind ytitle = spawn $XDG_DATA_HOME/uzbl/scripts/yank.sh 7 clipboard
# does the same as yurl but without needing a script
bind y2url = sh 'echo -n $6 | xclip'
# go the page from primary selection
-bind p = sh "echo uri `xclip -selection primary -o` > $4"
+bind p = sh 'echo "uri `xclip -selection primary -o`" > $4'
# go to the page in clipboard
-bind P = sh "echo uri `xclip -selection clipboard -o` > $4"
+bind P = sh 'echo "uri `xclip -selection clipboard -o`" > $4'
+# start a new uzbl instance from the page in primary selection
+bind 'p = sh 'exec uzbl --uri $(xclip -o)'
bind ZZ = exit
-bind S = js alert("hi");
+bind Xs = js alert("hi");
# example showing how to use sh
# it sends a command to the fifo, whose path is told via a positional param
# if fifo_dir is not set, it'll echo to a file named (null) somewhere >:) remember to delete it
@@ -146,7 +159,10 @@ bind S = js alert("hi");
# in the body. Any additional parameters you use will appear AFTER the default parameters (cfg file
# path, fifo & socket dirs, etc.)
bind XS = sh 'echo "js alert (\\"This is sent by the shell via a fifo\\")" > "$4"'
-bind dump = sh "echo dump_config > $4"
+
+bind !dump = sh "echo dump_config > $4"
+bind !reload = sh 'cat $1 > $4'
+
# this script allows you to configure (per domain) values to fill in form fields (eg login information) and to fill in these values automatically
bind za = spawn $XDG_DATA_HOME/uzbl/scripts/formfiller.sh
bind ze = spawn $XDG_DATA_HOME/uzbl/scripts/formfiller.sh edit
diff --git a/examples/data/uzbl/scripts/cookies.py b/examples/data/uzbl/scripts/cookies.py
index 3cc7eb0..1845c26 100755
--- a/examples/data/uzbl/scripts/cookies.py
+++ b/examples/data/uzbl/scripts/cookies.py
@@ -61,7 +61,10 @@ class FakeResponse:
return FakeHeaders(self.argv)
if __name__ == '__main__':
- jar = cookielib.MozillaCookieJar(os.environ['XDG_DATA_HOME']+'/uzbl/cookies.txt')
+ if os.environ['XDG_DATA_HOME']:
+ jar = cookielib.MozillaCookieJar(os.environ['XDG_DATA_HOME']+'/uzbl/cookies.txt')
+ else:
+ jar = cookielib.MozillaCookieJar(os.environ['HOME']+'.local/share/uzbl/cookies.txt')
try:
jar.load()
except:
@@ -79,4 +82,4 @@ if __name__ == '__main__':
res = FakeResponse(sys.argv)
jar.extract_cookies(res,req)
jar.save(ignore_discard=True) # save session cookies too
- #jar.save() # save everything but session cookies \ No newline at end of file
+ #jar.save() # save everything but session cookies
diff --git a/examples/data/uzbl/scripts/cookies.sh b/examples/data/uzbl/scripts/cookies.sh
index 78139d6..56b9c79 100755
--- a/examples/data/uzbl/scripts/cookies.sh
+++ b/examples/data/uzbl/scripts/cookies.sh
@@ -24,10 +24,9 @@
# http://kb.mozillazine.org/Cookies.txt
# don't always append cookies, sometimes we need to overwrite
-cookie_config=$XDG_CONFIG_HOME/uzbl/cookies
+cookie_config=${XDG_CONFIG_HOME:-$HOME/.config}/uzbl/cookies
[ -z "$cookie_config" ] && exit 1
-[ -d "$XDG_DATA_HOME/uzbl" ] || exit 1
-[ -d $XDG_DATA_HOME/uzbl/ ] && cookie_data=$XDG_DATA_HOME/uzbl/cookies.txt
+[ -d ${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/ ] && cookie_data=${XDG_DATA_HOME:-$home/.local/share}/uzbl/cookies.txt || exit 1
notifier=
diff --git a/examples/data/uzbl/scripts/formfiller.pl b/examples/data/uzbl/scripts/formfiller.pl
index c590836..9ac6959 100755
--- a/examples/data/uzbl/scripts/formfiller.pl
+++ b/examples/data/uzbl/scripts/formfiller.pl
@@ -3,7 +3,7 @@
# a slightly more advanced form filler
#
# uses settings file like: $keydir/<domain>
-
+#TODO: fallback to $HOME/.local/share
# user arg 1:
# edit: force editing of the file (fetches if file is missing)
# load: fill forms from file (fetches if file is missing)
diff --git a/examples/data/uzbl/scripts/formfiller.sh b/examples/data/uzbl/scripts/formfiller.sh
index d54c626..bbb9d1a 100755
--- a/examples/data/uzbl/scripts/formfiller.sh
+++ b/examples/data/uzbl/scripts/formfiller.sh
@@ -12,8 +12,9 @@
# something else (or empty): if file not available: new, otherwise load.
-keydir=$XDG_DATA_HOME/uzbl/forms
-[ -z "$keydir" ] && exit 1
+keydir=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/forms
+[ -d "`dirname $keydir`" ] || exit 1
+[ -d "$keydir" ] || mkdir "$keydir"
#editor=gvim
editor='urxvt -e vim'
diff --git a/examples/data/uzbl/scripts/history.sh b/examples/data/uzbl/scripts/history.sh
index 69f4034..ccc6b40 100755
--- a/examples/data/uzbl/scripts/history.sh
+++ b/examples/data/uzbl/scripts/history.sh
@@ -1,3 +1,5 @@
#!/bin/bash
#TODO: strip 'http://' part
-echo "$8 $6 $7" >> $XDG_DATA_HOME/uzbl/history
+file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/history
+[ -d `dirname $file` ] || exit 1
+echo "$8 $6 $7" >> $file
diff --git a/examples/data/uzbl/scripts/insert_bookmark.sh b/examples/data/uzbl/scripts/insert_bookmark.sh
index b3a7011..23c0d31 100755
--- a/examples/data/uzbl/scripts/insert_bookmark.sh
+++ b/examples/data/uzbl/scripts/insert_bookmark.sh
@@ -1,8 +1,7 @@
#!/bin/bash
-# you probably want your bookmarks file in your $XDG_DATA_HOME ( eg $HOME/.local/share/uzbl/bookmarks)
-[ -d "$XDG_DATA_HOME/uzbl" ] || exit 1
-file=$XDG_DATA_HOME/uzbl/bookmarks
+[ -d "${XDG_DATA_HOME:-$HOME/.local/share}/uzbl" ] || exit 1
+file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/bookmarks
which zenity &>/dev/null || exit 2
diff --git a/examples/data/uzbl/scripts/load_url_from_bookmarks.sh b/examples/data/uzbl/scripts/load_url_from_bookmarks.sh
index eb04873..78ee726 100755
--- a/examples/data/uzbl/scripts/load_url_from_bookmarks.sh
+++ b/examples/data/uzbl/scripts/load_url_from_bookmarks.sh
@@ -2,8 +2,8 @@
#NOTE: it's the job of the script that inserts bookmarks to make sure there are no dupes.
-file=$XDG_DATA_HOME/uzbl/bookmarks
-[ -z "$file" ] && exit
+file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/bookmarks
+[ -r "$file" ] || exit
COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030"
if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]'
then
diff --git a/examples/data/uzbl/scripts/load_url_from_history.sh b/examples/data/uzbl/scripts/load_url_from_history.sh
index 39ef302..57d634a 100755
--- a/examples/data/uzbl/scripts/load_url_from_history.sh
+++ b/examples/data/uzbl/scripts/load_url_from_history.sh
@@ -1,5 +1,6 @@
#!/bin/bash
-history_file=$XDG_DATA_HOME/uzbl/history
+history_file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/history
+[ -r "$history_file" ] || exit 1
# choose from all entries, sorted and uniqued
# goto=`awk '{print $3}' $history_file | sort -u | dmenu -i`
diff --git a/examples/data/uzbl/scripts/session.sh b/examples/data/uzbl/scripts/session.sh
index e2642c7..4dbae55 100755
--- a/examples/data/uzbl/scripts/session.sh
+++ b/examples/data/uzbl/scripts/session.sh
@@ -8,9 +8,10 @@
# and doesn't need to be called manually at any point.
# Add a line like 'bind quit = /path/to/session.sh endsession' to your config
+[ -d ${XDG_DATA_HOME:-$HOME/.local/share}/uzbl ] || exit 1
scriptfile=$0 # this script
-sessionfile=$XDG_DATA_HOME/uzbl/session # the file in which the "session" (i.e. urls) are stored
-configfile=$XDG_DATA_HOME/uzbl/config # uzbl configuration file
+sessionfile=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/session # the file in which the "session" (i.e. urls) are stored
+configfile=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/config # uzbl configuration file
UZBL="uzbl -c $configfile" # add custom flags and whatever here.
fifodir=/tmp # remember to change this if you instructed uzbl to put its fifos elsewhere
diff --git a/uzbl.c b/uzbl.c
index a18c7d5..d12b603 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -489,6 +489,14 @@ cmd_set_status() {
}
static void
+toggle_zoom_type (WebKitWebView* page, GArray *argv) {
+ (void)page;
+ (void)argv;
+
+ webkit_web_view_set_full_content_zoom (page, !webkit_web_view_get_full_content_zoom (page));
+}
+
+static void
toggle_status_cb (WebKitWebView* page, GArray *argv) {
(void)page;
(void)argv;
@@ -616,6 +624,7 @@ static struct {char *name; Command command[2];} cmdlist[] =
{ "stop", {view_stop_loading, 0}, },
{ "zoom_in", {view_zoom_in, 0}, }, //Can crash (when max zoom reached?).
{ "zoom_out", {view_zoom_out, 0}, },
+ { "toggle_zoom_type", {toggle_zoom_type, 0}, },
{ "uri", {load_uri, NOSPLIT} },
{ "js", {run_js, NOSPLIT} },
{ "script", {run_external_js, 0} },
diff --git a/uzbl.h b/uzbl.h
index 27293f9..ee9e693 100644
--- a/uzbl.h
+++ b/uzbl.h
@@ -262,6 +262,9 @@ static gboolean
download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
static void
+toggle_zoom_type (WebKitWebView* page, GArray *argv);
+
+static void
toggle_status_cb (WebKitWebView* page, GArray *argv);
static void