aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/config/config
diff options
context:
space:
mode:
Diffstat (limited to 'examples/config/config')
-rw-r--r--examples/config/config376
1 files changed, 376 insertions, 0 deletions
diff --git a/examples/config/config b/examples/config/config
new file mode 100644
index 0000000..eb17813
--- /dev/null
+++ b/examples/config/config
@@ -0,0 +1,376 @@
+# example uzbl config.
+# all settings are optional. you can use uzbl without any config at all (but it won't do much)
+
+set prefix = /usr/local
+
+# === Shortcuts / Aliases ===================================================
+
+# Config related events (use the request function):
+# request BIND <bind cmd> = <command>
+set bind = request BIND
+# request MODE_BIND <mode> <bind cmd> = <command>
+set mode_bind = request MODE_BIND
+# request MODE_CONFIG <mode> <key> = <value>
+set mode_config = request MODE_CONFIG
+# request ON_EVENT <EVENT_NAME> <command>
+set on_event = request ON_EVENT
+# request PROGRESS_CONFIG <key> = <value>
+set progress = request PROGRESS_CONFIG
+# request MODMAP <From> <To>
+set modmap = request MODMAP
+# request IGNORE_KEY <glob>
+set ignore_key = request IGNORE_KEY
+# request MODKEY_ADDITION <key1> <key2> <keyn> <result>
+set modkey_addition = request MODKEY_ADDITION
+
+# Action related events (use the event function):
+# event TOGGLE_MODES <mode1> <mode2> ... <moden>
+set toggle_modes = event TOGGLE_MODES
+
+set set_mode = set mode =
+set set_status = set status_message =
+set shell_cmd = sh -c
+
+# Spawn path shortcuts. In spawn the first dir+path match is used in "dir1:dir2:dir3:executable"
+set scripts_dir = $XDG_DATA_HOME/uzbl:@prefix/share/uzbl/examples/data:scripts
+
+# Javascipt helpers.
+set jsh = js var run=Uzbl.run; function get(k){return run("print \\\@"+k)}; function set(k, v) {run("set "+k+" = "+v)};
+
+# === Handlers ===============================================================
+
+# --- Hardcoded event handlers -----------------------------------------------
+
+# These handlers can't be moved to the new event system yet as we don't
+# support events that can wait for a response from a script.
+set cookie_handler = talk_to_socket $XDG_CACHE_HOME/uzbl/cookie_daemon_socket
+set scheme_handler = sync_spawn @scripts_dir/scheme.py
+
+# Open in the same window.
+#set new_window = sh 'echo uri "$8" > $4'
+# Open a link in a new window. equivalent to default behavior
+set new_window = sh 'uzbl-browser -u $8'
+
+# --- Optional dynamic event handlers ----------------------------------------
+
+# Download handler
+@on_event DOWNLOAD_REQUEST spawn @scripts_dir/download.sh %s \@proxy_url
+
+# Load start handler
+@on_event LOAD_START @set_status <span foreground="khaki">wait</span>
+
+# Load commit handlers
+@on_event LOAD_COMMIT @set_status <span foreground="green">recv</span>
+@on_event LOAD_COMMIT script @scripts_dir/scroll-percentage.js
+# Reset the keycmd on navigation
+@on_event LOAD_COMMIT @set_mode
+
+# Load finish handlers
+@on_event LOAD_FINISH @set_status <span foreground="gold">done</span>
+@on_event LOAD_FINISH spawn @scripts_dir/history.sh
+
+# Generate a FORM_ACTIVE event if an editable
+# element on the loaded site has initial focus
+@on_event LOAD_FINISH js if(document.activeElement.type == 'text') {Uzbl.run("event FORM_ACTIVE");}
+
+# Switch to insert mode if a (editable) html form is clicked
+@on_event FORM_ACTIVE @set_mode insert
+# Switch to command mode if anything else is clicked
+@on_event ROOT_ACTIVE @set_mode command
+
+# Example CONFIG_CHANGED event handler
+#@on_event CONFIG_CHANGED print Config changed: %1 = %2
+
+# === Behaviour and appearance ===============================================
+
+set show_status = 1
+set status_top = 0
+set status_background = #303030
+
+set modcmd_style = weight="bold" foreground="red"
+set keycmd_style = weight="light" foreground="red"
+set prompt_style = foreground="grey"
+set cursor_style = underline="single"
+set completion_style = foreground="green"
+set hint_style = weight="bold"
+
+set mode_section = <span background="khaki" foreground="black">[\@[\@mode_indicator]\@]</span>
+set keycmd_section = [<span \@prompt_style>\@[\@keycmd_prompt]\@</span><span \@modcmd_style>\@modcmd</span><span \@keycmd_style>\@keycmd</span><span \@completion_style>\@completion_list</span>]
+set progress_section = <span foreground="#606060">\@[\@progress_format]\@</span>
+set scroll_section = <span foreground="#606060">\@[\@scroll_message]\@</span>
+set uri_section = <span foreground="#99FF66">\@[\@uri]\@</span>
+set name_section = <span foreground="khaki">\@[\@NAME]\@</span>
+set status_section = <span foreground="orange">\@status_message</span>
+set selected_section = <span foreground="#606060">\@[\@SELECTED_URI]\@</span>
+
+set status_format = <span font_family="monospace">@mode_section @keycmd_section @progress_section @uri_section @name_section @status_section @scroll_section @selected_section</span>
+
+set title_format_long = \@keycmd_prompt \@raw_modcmd \@raw_keycmd \@TITLE - Uzbl browser <\@NAME> \@SELECTED_URI
+
+# Progress bar config
+@progress width = 8
+# %d = done, %p = pending %c = percent done, %i = int done, %s = spinner,
+# %t = percent pending, %o = int pending, %r = sprite scroll
+@progress format = [%d>%p]%c
+@progress done = =
+@progress pending =
+
+# Or ride those spinnas'
+#@progress format = [%d%s%p]
+#@progress spinner = -\\|/
+#@progress done = -
+#@progress pending =
+
+
+# === Core settings ==========================================================
+
+set useragent = Uzbl (Webkit @WEBKIT_MAJOR.@WEBKIT_MINOR.@WEBKIT_MICRO) (@(+uname -o)@ @(+uname -m)@ [@ARCH_UZBL]) (Commit @COMMIT)
+set fifo_dir = /tmp
+set socket_dir = /tmp
+
+
+# === Key modmapping and ignoring ============================================
+
+#modmap <From> <To>
+@modmap <Control> <Ctrl>
+@modmap <ISO_Left_Tab> <Shift-Tab>
+@modmap <space> <Space>
+
+#modkey_addition <Key1> <Key2> <Result>
+@modkey_addition <Shift> <Ctrl> <Meta>
+@modkey_addition <Shift> <Tab> <Shift-Tab>
+
+#ignore_key <glob>
+@ignore_key <ISO_*>
+@ignore_key <Shift>
+
+
+# === Mode bind aliases ======================================================
+
+# Global binding alias (this is done automatically inside the bind plugin).
+#set bind = @mode_bind global
+
+# Insert mode binding alias
+set ibind = @mode_bind insert
+
+# Command mode binding alias
+set cbind = @mode_bind command
+
+# Non-insert mode bindings alias (ebind for edit-bind).
+set ebind = @mode_bind global,-insert
+
+
+# === Global & keycmd editing binds ==========================================
+
+# Resets keycmd and returns to default mode.
+@bind <Escape> = @set_mode
+
+# Commands for editing and traversing the keycmd.
+@ebind <Return> = event KEYCMD_EXEC_CURRENT
+@ebind <Home> = event SET_CURSOR_POS
+@ebind <End> = event SET_CURSOR_POS -1
+@ebind <Left> = event SET_CURSOR_POS -
+@ebind <Right> = event SET_CURSOR_POS +
+@ebind <BackSpace> = event KEYCMD_BACKSPACE
+@ebind <Delete> = event KEYCMD_DELETE
+@ebind <Tab> = event START_COMPLETION
+# Readline-ish bindings.
+@ebind <Ctrl>w = event KEYCMD_STRIP_WORD
+@ebind <Ctrl>u = event SET_KEYCMD
+@ebind <Ctrl>a = event SET_CURSOR_POS 0
+@ebind <Ctrl>e = event SET_CURSOR_POS -1
+
+# Keycmd injection/append examples.
+#@ebind <Ctrl>su = event INJECT_KEYCMD \@uri
+#@ebind <Ctrl>st = event INJECT_KEYCMD \@title
+#@ebind <Ctrl>du = event APPEND_KEYCMD \@uri
+#@ebind <Ctrl>dt = event APPEND_KEYCMD \@title
+
+
+# === Mouse bindings =========================================================
+
+# Middle click
+# if clicked on a link open the link in a new uzbl window
+# otherwise open the selection in the current window
+set load_from_xclip = sh 'echo "uri $(xclip -o)" > $4'
+set open_new_window = sh 'uzbl-browser -u \@SELECTED_URI'
+@bind <Button2> = @jsh if(get("SELECTED_URI")) { run("\@open_new_window"); } else { run("\\\@load_from_xclip"); }
+
+
+# === Keyboard bindings ======================================================
+
+# With this command you can enter in any command at runtime when prefixed with
+# a colon.
+@cbind :_ = %s
+
+# --- Page movement binds ---
+@cbind j = scroll vertical 20
+@cbind k = scroll vertical -20
+@cbind h = scroll horizontal -20
+@cbind l = scroll horizontal 20
+@cbind <Page_Up> = scroll vertical -100%
+@cbind <Page_Down> = scroll vertical 100%
+@cbind << = scroll vertical begin
+@cbind >> = scroll vertical end
+@cbind ^ = scroll horizontal begin
+@cbind $ = scroll horizontal end
+@cbind <Space> = scroll vertical end
+
+# --- Navigation binds ---
+@cbind b = back
+@cbind m = forward
+@cbind S = stop
+@cbind r = reload
+@cbind R = reload_ign_cache
+
+# --- Zoom binds ---
+@cbind + = zoom_in
+@cbind - = zoom_out
+@cbind T = toggle_zoom_type
+@cbind 1 = set zoom_level 1.0
+@cbind 2 = set zoom_level 2.0
+
+# --- Appearance binds ---
+@cbind t = toggle_status
+
+# --- Page searching binds ---
+@cbind /* = search %s
+@cbind ?* = search_reverse %s
+# Jump to next and previous items
+@cbind n = search
+@cbind N = search_reverse
+
+# --- Web searching binds ---
+@cbind gg<Google:>_ = uri http://www.google.com/search?q=\@<encodeURIComponent(%r)>\@
+@cbind \\awiki<Archwiki:>_ = uri http://wiki.archlinux.org/index.php/Special:Search?search=\@<encodeURIComponent(%r)>\@&go=Go
+@cbind \\wiki<Wikipedia:>_ = uri http://en.wikipedia.org/w/index.php?title=Special:Search&search=\@<encodeURIComponent(%r)>\@&go=Go
+
+# --- Handy binds ---
+# Set function shortcut
+@cbind s<var:>_<value:>_ = set %1 = %2
+# Exit binding
+@cbind ZZ = exit
+# Dump config to stdout
+@cbind !dump = sh "echo dump_config > $4"
+# Reload config
+@cbind !reload = sh "sed '/^# === Post-load misc commands/,$d' $1 > $4"
+# Uzbl Terminal. TODO explain why this is useful
+@cbind <Ctrl><Alt>t = sh 'xterm -e "socat unix-connect:$5 -"'
+#@cbind <Ctrl><Alt>t = sh 'urxvt -e socat unix-connect:$5 -'
+
+# --- Uri opening prompts ---
+@cbind o<uri:>_ = uri %s
+# Or have it load the current uri into the keycmd for editing
+@cbind O<uri:\@uri>_ = uri %s
+
+# --- Mode setting binds ---
+# Changing mode via set.
+@cbind I = @set_mode insert
+# Or toggle between modes by raising the toggle event.
+set toggle_cmd_ins = @toggle_modes command insert
+@cbind i = @toggle_cmd_ins
+# And the global toggle bind.
+@bind <Ctrl>i = @toggle_cmd_ins
+
+# --- Hard-bound bookmarks ---
+@cbind gh = uri http://www.uzbl.org
+
+# --- Yanking & pasting binds ---
+@cbind y<Yank (t)itle or (u)rl:>* = @jsh if('%s' == 'u') { run("sh 'echo -n $6 | xclip'"); } else if('%s' == 't') { run("sh 'echo -n $7 | xclip'"); }; run('event SET_KEYCMD');
+
+# Go the page from primary selection
+@cbind p = sh 'echo "uri `xclip -selection primary -o`" > $4'
+# Go to the page in clipboard
+@cbind P = sh 'echo "uri `xclip -selection clipboard -o`" > $4'
+# Start a new uzbl instance from the page in primary selection
+@cbind 'p = sh 'exec uzbl-browser --uri $(xclip -o)'
+
+# --- Bookmark inserting binds ---
+@cbind <Ctrl>b<tags:>_ = sh 'echo -e "$6 %s" >> $XDG_DATA_HOME/uzbl/bookmarks'
+# Or use a script to insert a bookmark.
+@cbind B = spawn @scripts_dir/insert_bookmark.sh
+
+# --- Bookmark/history loading ---
+@cbind U = spawn @scripts_dir/load_url_from_history.sh
+@cbind u = spawn @scripts_dir/load_url_from_bookmarks.sh
+
+# --- Link following (similar to vimperator and konqueror) ---
+@cbind fl* = script @scripts_dir/follow_Numbers.js %s
+# Or number with strings instead of numbers:
+@cbind fL* = script @scripts_dir/follow_Numbers_Strings.js %s
+
+# --- Form filler binds ---
+# this script allows you to configure (per domain) values to fill in form
+# fields (eg login information) and to fill in these values automatically
+set formfiller = spawn @scripts_dir/formfiller
+@cbind za = @{formfiller}.sh
+@cbind ze = @{formfiller}.sh edit
+@cbind zn = @{formfiller}.sh new
+@cbind zl = @{formfiller}.sh load
+# Or the more advanced implementation using perl: (could not get this to run - Dieter)
+@cbind LL = @{formfiller}.pl load
+@cbind LN = @{formfiller}.pl new
+@cbind LE = @{formfiller}.pl edit
+
+# --- External edit script configuration & binds ---
+# Edit form input fields in an external editor (gvim, emacs, urxvt -e vim, ..)
+set external_editor = gvim
+#set external_editor = xterm -e vim
+@cbind E = script @scripts_dir/extedit.js
+# And add menu option.
+menu_editable_add Open in @external_editor = script @scripts_dir/extedit.js
+
+# --- Examples ---
+# Example showing how to use uzbl's fifo to execute a command.
+#@bind X1 = sh 'echo "set zoom_level = 1.0" > "$4"'
+#@bind X2 = sh 'echo "js alert (\\"This is sent by the shell via a fifo\\")" > "$4"'
+
+# Working with the javascript helper variable jsh.
+#@bind X3 = @jsh alert(get('zoom_level'));
+#@bind X4 = @jsh if(get('mode') == "insert") { alert("You are in insert mode") } else { alert(get('mode')+" is a silly mode.") };
+
+
+# === Context menu items =====================================================
+
+# Default context menu
+menu_add Google = set uri = http://google.com
+menu_add Go Home = set uri = http://uzbl.org
+menu_separator separator_1
+menu_add Quit uzbl = exit
+
+# Link context menu
+menu_link_add Print Link = print \@SELECTED_URI
+
+
+# === Mode configuration =====================================================
+
+# Define some mode specific uzbl configurations.
+set command = @mode_config command
+set insert = @mode_config insert
+set stack = @mode_config stack
+
+# Command mode config.
+@command keycmd_style = foreground="red"
+@command status_background = #202020
+@command mode_indicator = Cmd
+
+# Insert mode config.
+@insert status_background = #303030
+@insert mode_indicator = Ins
+
+# Multi-stage-binding mode config.
+@stack keycmd_events = 1
+@stack modcmd_updates = 1
+@stack forward_keys = 0
+@stack keycmd_style = foreground="red"
+@stack prompt_style = foreground="#888" weight="light"
+@stack status_background = #202020
+@stack mode_indicator = Bnd
+
+set default_mode = command
+
+
+# === Post-load misc commands ===============================================
+
+# Set the "home" page.
+set uri = uzbl.org/doesitwork/@COMMIT