# === Core settings ==========================================================
# common directory locations
set prefix = @(echo $PREFIX)@
set data_home = @(echo $XDG_DATA_HOME)@
set config_home = @(echo $XDG_CONFIG_HOME)@
set cache_home = @(echo $XDG_CACHE_HOME)@
# Interface paths.
set fifo_dir = /tmp
set socket_dir = /tmp
set useragent =
set shell_cmd = sh -c
# === General config aliases =================================================
# Config related events (use the request function):
# 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 ON_SET <key/glob> <command>
set on_set = request ON_SET
# 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
# request TOGGLE_MODES <mode1> <mode2> ... <moden>
set toggle_modes = request TOGGLE_MODES
set set_mode = set mode =
set set_status = set status_message =
# Spawn path shortcuts. In spawn the first dir+path match is used in "dir1:dir2:dir3:executable"
set scripts_dir = @config_home/uzbl:@prefix/share/uzbl/examples/data:scripts
# === Hardcoded 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 scheme_handler = sync_spawn @scripts_dir/scheme.py
set authentication_handler = sync_spawn @scripts_dir/auth.py
set download_handler = sync_spawn @scripts_dir/my_download.sh
# === Dynamic event handlers =================================================
# What to do when a website wants to open a new window:
# Open link in new window
@on_event NEW_WINDOW sh 'uzbl-browser ${1:+-u "$1"}' %r
# Open in current window (also see the REQ_NEW_WINDOW event handler below)
#@on_event NEW_WINDOW uri %s
# What to do when the user requests a new window:
# If your the NEW_WINDOW handler opens the uri in the current window, you'll
# probably want to change this handler to open a new window or tab.
@on_event REQ_NEW_WINDOW event NEW_WINDOW %s
# Load start handler
#@on_event LOAD_START @set_status <span foreground="red">WAIT</span>
@on_event LOAD_START set progress_style = foreground="#ff0000"
# Reset the keycmd on navigation
@on_event LOAD_START @set_mode
# Load commit handlers
#@on_event LOAD_COMMIT @set_status <span foreground="gold">RECV</span>
@on_event LOAD_COMMIT set progress_style = foreground="#ffff00"
#@on_event LOAD_COMMIT set stylesheet_uri = file:///@config_home/uzbl/default.css
# add some javascript to the page for other 'js' and 'script' commands to access later.
@on_event LOAD_COMMIT js uzbl = {};
@on_event LOAD_COMMIT script @scripts_dir/formfiller.js
# Custom scripts
#@on_event LOAD_COMMIT script @scripts_dir/flashblock.js
@on_event LOAD_COMMIT script @scripts_dir/dark_inputs.js
#@on_event LOAD_COMMIT script @scripts_dir/smooth_scroll.js
# Userscripts/per-site-settings. See the script and the example configuration for details
#@on_event LOAD_COMMIT spawn @scripts_dir/per-site-settings.py @data_home/uzbl/per-site-settings
# Load finish handlers
#@on_event LOAD_FINISH @set_status <span foreground="green">OK</span>
@on_event LOAD_FINISH set progress_style = foreground="#00ff00"
@on_event LOAD_FINISH spawn @scripts_dir/my_history.sh
@on_event LOAD_FINISH sh 'if [ "\@<document.activeElement.type>\@" = "text" ]; then echo "event FORM_ACTIVE" > $UZBL_FIFO; fi'
# 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
# Scroll percentage calculation
@on_event SCROLL_VERT set scroll_message = \@<(function(){var p='--';if(%3>%4){p=(%1/(%3-%4));p=Math.round(10000*p)/100;};return p+'%';})()>\@
# === Behaviour and appearance ===============================================
set show_status = 1
set status_top = 0
set status_background = #000033
set default_style = font_desc="inconsolata 10"
set modcmd_style = weight="bold" foreground="red"
set keycmd_style = weight="bold" foreground="red"
set progress_style = foreground="#ff0000"
set prompt_style = weight="bold" foreground="grey"
set cursor_style = underline="single"
set completion_style = foreground="green"
set hint_style = weight="bold"
set mode_section = <span foreground="#ffff00">\@[\@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 \@progress_style>\@[\@progress.output]\@</span>
set scroll_section = <span foreground="#333366">\@[\@scroll_message]\@</span>
set uri_section = <span foreground="#ffffff">\@[\@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 download_section = <span foreground="white">\@downloads</span>
set status_format = <span \@default_style>@progress_section @uri_section | @keycmd_section</span>
set status_format_right = <span \@default_style>@selected_section|@mode_section|@scroll_section</span>
set title_format_long = \@keycmd_prompt \@raw_modcmd \@raw_keycmd \@TITLE - Uzbl browser <\@NAME> \@SELECTED_URI
# Progress bar config
# %d = done, %p = pending %c = percent done, %i = int done, %s = spinner,
# %t = percent pending, %o = int pending, %r = sprite scroll
set progress.format = %c
# === Configure cookie blacklist ========================================================
# Accept 'session cookies' from uzbl.org (when you have a whitelist all other cookies are dropped)
#request WHITELIST_COOKIE domain 'uzbl.org$' expires '^$'
# Drop google analytics tracking cookies (applied after whitelists if any)
#request BLACKLIST_COOKIE name '^__utm.$'
# === Key binding configuration ==============================================
# --- Internal modmapping and ignoring ---------------------------------------
#modmap <From> <To>
@modmap <Control> <Ctrl>
@modmap <ISO_Left_Tab> <Shift-Tab>
@modmap <space> <Space>
@modmap <KP_Enter> <Enter>
@modmap <Mod1> <Alt>
#modkey_addition <Key1> <Key2> <Result>
@modkey_addition <Shift> <Ctrl> <Meta>
@modkey_addition <Shift> <Tab> <Shift-Tab>
@modkey_addition <Shift> <Insert> <Shift-Insert>
#ignore_key <glob>
@ignore_key <ISO_*>
@ignore_key <Shift>
@ignore_key <Multi_key>
# --- Bind aliases -----------------------------------------------------------
# request BIND <bind cmd> = <command>
set bind = request MODE_BIND global
# request MODE_BIND <mode> <bind cmd> = <command>
set mode_bind = request MODE_BIND
# 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.
@on_event ESCAPE @set_mode
@on_event ESCAPE event KEYCMD_CLEAR
@bind <Escape> = event ESCAPE
@bind <Ctrl>[ = event ESCAPE
# Commands for editing and traversing the keycmd.
@ebind <Return> = event KEYCMD_EXEC_CURRENT
@ebind <Home> = event SET_CURSOR_POS 0
@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
@ebind <Up> = event HISTORY_PREV
@ebind <Down> = event HISTORY_NEXT
@ebind <Ctrl>r<search:>_ = event HISTORY_SEARCH %s
# 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 open in new window
@bind <Button2> = sh 'if [ "+-u "$1"" ]; then echo "event REQ_NEW_WINDOW $1" > "$UZBL_FIFO"; else echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"; fi' '\@SELECTED_URI'
# --- Keyboard bindings ------------------------------------------------------
# With this command you can enter in any command at runtime when prefixed with
# a colon.
@cbind :_ = %s
# open a new window or a new tab (see the on_event NEW_WINDOW settings above)
#@cbind w = event REQ_NEW_WINDOW
# Page movement binds
#@cbind j = scroll vertical 20
#@cbind k = scroll vertical -20
#@cbind h = scroll horizontal -20
#@cbind l = scroll horizontal 20
@cbind <Down> = scroll vertical 20
@cbind <Up> = scroll vertical -20
@cbind <Left> = scroll horizontal -20
@cbind <Right> = scroll horizontal 20
@cbind <Page_Up> = scroll vertical -100%
@cbind <Page_Down> = scroll vertical 100%
@cbind <Home> = scroll vertical begin
@cbind <End> = 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
@cbind < = back
@cbind > = forward
@cbind <F5> = reload
@cbind <Ctrl><F5> = reload_ign_cache
@cbind s = stop
# 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
@cbind 3 = set zoom_level = 3.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
# 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 > "$UZBL_FIFO"'
# Reload all variables in the config
@cbind !reload = sh "sed '/^# === Post-load misc commands/,$d' \"$UZBL_CONFIG\" | grep '^set ' > \"$UZBL_FIFO\""
# Use socat to directly inject commands into uzbl-core and view events
# raised by uzbl-core:
#@cbind <Ctrl><Alt>t = sh 'xterm -e "socat unix-connect:\"$UZBL_SOCKET\" -"'
@cbind <Ctrl><Alt>t = sh 'urxvt -e "socat unix-connect:\"$UZBL_SOCKET\" -"'
# 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
@cbind i = @set_mode insert
@bind <Ctrl>i = @set_mode insert
# Yanking & pasting binds
@cbind yy = sh 'echo -n "$UZBL_URI" | xclip'
@cbind yU = sh 'echo -n "+-u "$1"" | xclip' \@SELECTED_URI
@cbind yt = sh 'echo -n "$UZBL_TITLE" | xclip'
# Clone current window
@cbind c = event REQ_NEW_WINDOW \@uri
# Go the page from primary selection
@cbind p = sh 'echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"'
# Start a new uzbl instance from the page in primary selection
@cbind P = sh 'echo "event REQ_NEW_WINDOW $(xclip -o)" > "$UZBL_FIFO"'
# Go to the page in clipboard
@cbind 'p = sh 'echo "uri $(xclip -selection clipboard -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"'
# paste primary selection into keycmd at the cursor position
@bind <Shift-Insert> = sh 'echo "event INJECT_KEYCMD $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"'
# Bookmark inserting binds
@cbind <Ctrl>d<Tags:>_ = spawn @scripts_dir/bookmark.sh add %s
@cbind <Alt>d<Tags:>_ = spawn @scripts_dir/bookmark.sh add-all %s
@cbind <Ctrl>l = spawn @scripts_dir/bookmark.sh load
@cbind <Alt>l = spawn @scripts_dir/bookmark.sh load-tag
@cbind <Ctrl>f = spawn @scripts_dir/bookmark.sh delete-tag
# History loading
@cbind <Ctrl>h = spawn @scripts_dir/load_url_from_history.sh
# Link following (similar to vimperator and konqueror)
# Set custom keys you wish to use for navigation. Some common examples:
set follow_hint_keys = 0123456789
#set follow_hint_keys = qwerty
#set follow_hint_keys = asdfghjkl;
#set follow_hint_keys = thsnd-rcgmvwb/;789aefijkopquxyz234
@cbind fl* = spawn @scripts_dir/follow.sh "%s"
@cbind gi = spawn @scripts_dir/go_input.sh
# 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.
# This implementation allows you to save multiple profiles for each form
# (think about multiple accounts on some website).
set formfiller = spawn @scripts_dir/formfiller.sh
@cbind za = @formfiller add
@cbind ze = @formfiller edit
@cbind zn = @formfiller new
@cbind zl = @formfiller load
# --- 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"'
# === 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 = #000022
@command mode_indicator = CMD
@command keycmd_events = 1
@command forward_keys = 0
@command modcmd_updates = 1
# Insert mode config.
@insert status_background = #000033
@insert mode_indicator = INS
@insert forward_keys = 1
@insert keycmd_events = 0
@insert modcmd_updates = 0
# Multi-stage-binding mode config.
@stack keycmd_style = foreground="red" weight="bold"
@stack status_background = #000022
@stack mode_indicator = BND
@stack prompt_style = foreground="#888" weight="light"
@stack keycmd_events = 1
@stack modcmd_updates = 1
@stack forward_keys = 0
set default_mode = command
# === Post-load misc commands ================================================
sync_spawn_exec @scripts_dir/load_cookies.sh
sync_spawn_exec @scripts_dir/load_cookies.sh @data_home/uzbl/session-cookies.txt
# Set the "home" page.
#set uri = https://duckduckgo.com?kp=-1&kl=wt-wt&kh=1&kj=r&kw=w&kv=1
set uri = https://www.google.com
# Web searching binds
@cbind gg<Google:>_ = uri https://www.google.com/search?q=\@<encodeURIComponent(%r)>\@
#@cbind gg<DuckDuckGo:>_ = uri https://duckduckgo.com/?q=%s&kp=-1&kl=wt-wt&kh=1&kj=r&kw=w&kv=1
#@cbind gg<Seeks:>_ = uri https://yooook.net/site/seeks/search?q=\@<encodeURIComponent(%r)>\@&expansion=1&action=expand
#@cbind gg<Seeks:>_ = uri https://www.seeks-project.info/search_exp.php/search?q=\@<encodeURIComponent(%r)>\@&expansion=1&action=expand
# Surfraw
@cbind sr<Surfraw:>_ = sh 'echo "set uri = $(surfraw -print %s)" > $4'
@cbind wiki<Wikipedia:>_ = sh 'echo "set uri = $(surfraw -print $8 %s)" > $4' wikipedia
@cbind aur<AUR:>_ = sh 'echo "set uri = $(surfraw -print $8 %s)" > $4' aur
# Icon
set icon = @prefix/share/uzbl/examples/data/uzbl.png
# Proxy
# set proxy_url = http://127.0.0.1:8118
# vim: set fdm=syntax: