config (19102B)
1 # Example uzbl config. All settings are optional. You can use uzbl without 2 # any config at all (but it won't do much). 3 4 # === Core settings ========================================================== 5 6 # common directory locations 7 set prefix = @(echo $PREFIX)@ 8 set data_home = @(echo $XDG_DATA_HOME)@ 9 set cache_home = @(echo $XDG_CACHE_HOME)@ 10 set config_home = @(echo $XDG_CONFIG_HOME)@ 11 12 # Interface paths. 13 set fifo_dir = /tmp 14 set socket_dir = /tmp 15 16 set shell_cmd = sh -c 17 18 # === General config aliases ================================================= 19 20 # Config related events (use the request function): 21 # request MODE_CONFIG <mode> <key> = <value> 22 set mode_config = request MODE_CONFIG 23 # request ON_EVENT <EVENT_NAME> <command> 24 set on_event = request ON_EVENT 25 # request ON_SET <key/glob> <command> 26 set on_set = request ON_SET 27 # request MODMAP <From> <To> 28 set modmap = request MODMAP 29 # request IGNORE_KEY <glob> 30 set ignore_key = request IGNORE_KEY 31 # request TOGGLE_MODES <mode1> <mode2> ... <moden> 32 set toggle_modes = request TOGGLE_MODES 33 34 set set_mode = set mode = 35 set set_status = set status_message = 36 37 # Spawn path shortcuts. In spawn the first dir+path match is used in "dir1:dir2:dir3:executable" 38 set scripts_dir = @data_home/uzbl:@prefix/share/uzbl/examples/data:scripts 39 40 # === Hardcoded handlers ===================================================== 41 42 # These handlers can't be moved to the new event system yet as we don't 43 # support events that can wait for a response from a script. 44 set scheme_handler = sync_spawn @scripts_dir/scheme.py 45 #set request_handler = sync_spawn @scripts_dir/request.py 46 set authentication_handler = sync_spawn @scripts_dir/auth.py 47 set download_handler = sync_spawn @scripts_dir/download.sh 48 49 # === Dynamic event handlers ================================================= 50 51 # What to do when a website wants to open a new window: 52 # Open link in new window 53 @on_event NEW_WINDOW sh 'uzbl-browser ${1:+-u "$1"}' %r 54 # Open in current window (also see the REQ_NEW_WINDOW event handler below) 55 #@on_event NEW_WINDOW uri %s 56 # Open in new tab. Other options are NEW_TAB_NEXT, NEW_BG_TAB and NEW_BG_TAB_NEXT. 57 #@on_event NEW_WINDOW event NEW_TAB %s 58 59 # What to do when the user requests a new window: 60 # If your the NEW_WINDOW handler opens the uri in the current window, you'll 61 # probably want to change this handler to open a new window or tab. 62 @on_event REQ_NEW_WINDOW event NEW_WINDOW %s 63 64 # Load start handler 65 @on_event LOAD_START @set_status <span foreground="khaki">wait</span> 66 # Reset the keycmd on navigation 67 @on_event LOAD_START @set_mode 68 69 # Load commit handlers 70 @on_event LOAD_COMMIT @set_status <span foreground="green">recv</span> 71 72 # add some javascript to the page for other 'js' and 'script' commands to access later. 73 @on_event LOAD_COMMIT js uzbl = {}; 74 @on_event LOAD_COMMIT script @scripts_dir/formfiller.js 75 @on_event LOAD_COMMIT script @scripts_dir/follow.js 76 77 # Userscripts/per-site-settings. See the script and the example configuration for details 78 #@on_event LOAD_COMMIT spawn @scripts_dir/per-site-settings.py @data_home/uzbl/per-site-settings 79 80 # Load finish handlers 81 @on_event LOAD_FINISH @set_status <span foreground="gold">done</span> 82 @on_event LOAD_FINISH spawn @scripts_dir/history.sh 83 84 # Switch to insert mode if a (editable) html form is clicked 85 @on_event FOCUS_ELEMENT sh 'if [ "$1" = INPUT -o "$1" = TEXTAREA -o "$1" = SELECT ]; then echo "@set_mode insert" > $UZBL_FIFO; fi' %s 86 # Switch to command mode if anything else is clicked 87 @on_event ROOT_ACTIVE @set_mode command 88 89 # Example CONFIG_CHANGED event handler 90 #@on_event CONFIG_CHANGED print Config changed: %1 = %2 91 92 # Scroll percentage calculation 93 @on_event SCROLL_VERT set scroll_message = \@<(function(curr, min, max, size){if(max == size) return '--'; var p=(curr/(max - size)); return Math.round(10000*p)/100;})(%1,%2,%3,%4)>\@% 94 95 # === Behaviour and appearance =============================================== 96 97 # Custom CSS can be defined here, including link follower hint styles 98 set stylesheet_uri = file://@config_home/uzbl/style.css 99 100 set show_status = 1 101 set status_top = 0 102 set status_background = #303030 103 104 set modcmd_style = weight="bold" foreground="red" 105 set keycmd_style = weight="light" foreground="red" 106 set prompt_style = foreground="grey" 107 set cursor_style = underline="single" 108 set completion_style = foreground="green" 109 set hint_style = weight="bold" 110 111 set mode_section = <span background="khaki" foreground="black">[\@[\@mode_indicator]\@]</span> 112 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>] 113 set progress_section = <span foreground="#606060">\@[\@progress.output]\@</span> 114 set scroll_section = <span foreground="#606060">\@[\@scroll_message]\@</span> 115 set uri_section = <span foreground="#99FF66">\@[\@uri]\@</span> 116 set name_section = <span foreground="khaki">\@[\@NAME]\@</span> 117 set status_section = <span foreground="orange">\@status_message</span> 118 set selected_section = <span foreground="#606060">\@[\@SELECTED_URI]\@</span> 119 120 set download_section = <span foreground="white">\@downloads</span> 121 122 set status_format = <span font_family="monospace">@mode_section @keycmd_section @progress_section @name_section @status_section @scroll_section @selected_section @download_section</span> 123 set status_format_right = <span font_family="monospace"><span foreground="#666">uri:</span> @uri_section</span> 124 125 set title_format_long = \@keycmd_prompt \@raw_modcmd \@raw_keycmd \@TITLE - Uzbl browser <\@NAME> \@SELECTED_URI 126 127 # Progress bar config 128 # %d = done, %p = pending %c = percent done, %i = int done, %s = spinner, 129 # %t = percent pending, %o = int pending, %r = sprite scroll 130 set progress.width = 8 131 set progress.format = [%d>%p]%c 132 set progress.done = = 133 set progress.pending = 134 135 # === Useragent setup ======================================================== 136 137 set useragent = Uzbl (Webkit @{WEBKIT_MAJOR}.@{WEBKIT_MINOR}) (@(+uname -sm)@ [@ARCH_UZBL]) 138 139 # === Configure cookie blacklist ======================================================== 140 141 # Accept 'session cookies' from uzbl.org (when you have a whitelist all other cookies are dropped) 142 #request WHITELIST_COOKIE domain 'uzbl.org$' expires '^$' 143 144 # Drop google analytics tracking cookies (applied after whitelists if any) 145 #request BLACKLIST_COOKIE name '^__utm.$' 146 147 # === SSL related configuration ============================================== 148 149 # Set it to certificates store of your distribution, or your own CAfile. 150 set ssl_ca_file = /etc/ssl/certs/ca-certificates.crt 151 set ssl_verify = 1 152 # Command to toggle ssl_verify value: 153 @cbind !ssl = chain 'toggle ssl_verify' 'reload' 154 # Example SSL error handler: 155 @on_event LOAD_ERROR js var patt=new RegExp('SSL handshake failed'); if (patt.test('%3')) {alert ('%3');} 156 157 # === Key binding configuration ============================================== 158 # --- Internal modmapping and ignoring --------------------------------------- 159 160 #modmap <From> <To> 161 @modmap <Control> <Ctrl> 162 @modmap <ISO_Left_Tab> <Shift-Tab> 163 @modmap <space> <Space> 164 @modmap <KP_Enter> <Enter> 165 166 #ignore_key <glob> 167 @ignore_key <ISO_*> 168 @ignore_key <Shift> 169 @ignore_key <Multi_key> 170 @ignore_key <Mod2> 171 172 # --- Bind aliases ----------------------------------------------------------- 173 174 # request BIND <bind cmd> = <command> 175 set bind = request MODE_BIND global 176 177 # request MODE_BIND <mode> <bind cmd> = <command> 178 set mode_bind = request MODE_BIND 179 180 # Insert mode binding alias 181 set ibind = @mode_bind insert 182 183 # Command mode binding alias 184 set cbind = @mode_bind command 185 186 # Non-insert mode bindings alias (ebind for edit-bind). 187 set ebind = @mode_bind global,-insert 188 189 # --- Global & keycmd editing binds ------------------------------------------ 190 191 # Resets keycmd and returns to default mode. 192 @on_event ESCAPE @set_mode 193 @on_event ESCAPE event KEYCMD_CLEAR 194 @on_event ESCAPE js uzbl.follow.clearHints() 195 @on_event ESCAPE search_clear 196 @on_event ESCAPE js window.getSelection().removeAllRanges() 197 @bind <Escape> = event ESCAPE 198 @bind <Ctrl>[ = event ESCAPE 199 200 # Commands for editing and traversing the keycmd. 201 @ebind <Return> = event KEYCMD_EXEC_CURRENT 202 @ebind <Home> = event SET_CURSOR_POS 0 203 @ebind <End> = event SET_CURSOR_POS -1 204 @ebind <Left> = event SET_CURSOR_POS - 205 @ebind <Right> = event SET_CURSOR_POS + 206 @ebind <BackSpace> = event KEYCMD_BACKSPACE 207 @ebind <Delete> = event KEYCMD_DELETE 208 @ebind <Tab> = event START_COMPLETION 209 # Readline-ish bindings. 210 @ebind <Ctrl>w = event KEYCMD_STRIP_WORD \ -./&?= 211 @ebind <Ctrl>u = event SET_KEYCMD 212 @ebind <Ctrl>a = event SET_CURSOR_POS 0 213 @ebind <Ctrl>e = event SET_CURSOR_POS -1 214 215 @ebind <Up> = event HISTORY_PREV 216 @ebind <Down> = event HISTORY_NEXT 217 @ebind <Ctrl>r<search:>_ = event HISTORY_SEARCH %s 218 # Keycmd injection/append examples. 219 #@ebind <Ctrl>su = event INJECT_KEYCMD \@uri 220 #@ebind <Ctrl>st = event INJECT_KEYCMD \@title 221 #@ebind <Ctrl>du = event APPEND_KEYCMD \@uri 222 #@ebind <Ctrl>dt = event APPEND_KEYCMD \@title 223 224 # --- Mouse bindings --------------------------------------------------------- 225 226 # Middle click open in new window 227 @bind <Button2> = sh 'if [ "$1" ]; then echo "event REQ_NEW_WINDOW $1" > "$UZBL_FIFO"; else echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"; fi' '\@SELECTED_URI' 228 229 # --- Keyboard bindings ------------------------------------------------------ 230 231 # With this command you can enter in any command at runtime when prefixed with 232 # a colon. 233 @cbind :_ = %s 234 235 # open a new window or a new tab (see the on_event NEW_WINDOW settings above) 236 @cbind W = event REQ_NEW_WINDOW 237 238 # Page movement binds 239 @cbind j = scroll vertical 20 240 @cbind k = scroll vertical -20 241 @cbind h = scroll horizontal -20 242 @cbind l = scroll horizontal 20 243 @cbind <Page_Down> = scroll vertical 100% 244 @cbind <Ctrl>d = scroll vertical 50% 245 @cbind <Page_Up> = scroll vertical -100% 246 @cbind <Ctrl>u = scroll vertical -50% 247 @cbind gg = scroll vertical begin 248 @cbind G = scroll vertical end 249 @cbind <Home> = scroll vertical begin 250 @cbind <End> = scroll vertical end 251 @cbind ^ = scroll horizontal begin 252 @cbind $ = scroll horizontal end 253 @cbind <Space> = scroll vertical 50% 254 @cbind :<Go To:>_ = scroll vertical %r! 255 @cbind _:<Go To:>_ = scroll horizontal %r! 256 257 # Navigation binds 258 @cbind H = back 259 @cbind L = forward 260 @cbind S = stop 261 @cbind r = reload 262 @cbind R = reload_ign_cache 263 264 # Mouse bindings 265 @cbind <Button8> = back 266 @cbind <Button9> = forward 267 268 # Zoom binds 269 @cbind + = zoom_in 270 @cbind - = zoom_out 271 @cbind T = toggle zoom_type 272 @cbind 1 = set zoom_level = 1.0 273 @cbind 2 = set zoom_level = 2.0 274 275 # Appearance binds 276 @cbind t = toggle show_status 277 278 # Page searching binds 279 @cbind /* = search %s 280 @cbind ?* = search_reverse %s 281 # Jump to next and previous items 282 @cbind n = search 283 @cbind N = search_reverse 284 285 # Print pages to a printer 286 @cbind <Ctrl>p = hardcopy 287 288 # Web searching binds 289 @cbind sw<Startpage:>_ = uri https://ixquick.com/do/search?query=%s 290 @cbind sg<Google:>_ = uri https://www.google.com/search?q=\@<encodeURIComponent(%r)>\@ 291 @cbind ddg<DuckDuckGo:>_ = uri https://duckduckgo.com/?q=%s 292 @cbind awiki<Archwiki:>_ = uri http://wiki.archlinux.org/index.php/Special:Search?search=\@<encodeURIComponent(%r)>\@&go=Go 293 @cbind wiki<Wikipedia:>_ = uri https://en.wikipedia.org/w/index.php?title=Special:Search&search=\@<encodeURIComponent(%r)>\@&go=Go 294 295 # Handy binds 296 # Set function shortcut 297 @cbind S<var:>_<value:>_ = set %1 = %2 298 # Exit binding 299 @cbind ZZ = exit 300 # Dump config to stdout 301 @cbind !dump = sh 'echo dump_config > "$UZBL_FIFO"' 302 # Reload all variables in the config 303 @cbind !reload = sh "sed '/^# === Post-load misc commands/,$d' \"$UZBL_CONFIG\" | grep '^set ' > \"$UZBL_FIFO\"" 304 305 # Use socat to directly inject commands into uzbl-core and view events 306 # raised by uzbl-core: 307 @cbind <Ctrl><Mod1>t = sh 'xterm -e "socat unix-connect:\"$UZBL_SOCKET\" -"' 308 #@cbind <Ctrl><Mod1>t = sh 'urxvt -e socat unix-connect:"$UZBL_SOCKET" -' 309 310 # Uri opening prompts 311 @cbind o<uri:>_ = uri %s 312 # Or have it load the current uri into the keycmd for editing 313 @cbind O<uri:\@uri>_ = uri %s 314 315 # Mode setting binds 316 @cbind i = @set_mode insert 317 @bind <Ctrl>i = @set_mode insert 318 319 # Hard-bound bookmarks 320 @cbind gh = uri http://www.uzbl.org 321 322 # New window binds 323 @cbind gw = event REQ_NEW_WINDOW 324 325 # SSL-ify bindings 326 @cbind zs = uri \@(echo "$UZBL_URI" | sed -e 's/^http:/https:/')\@ 327 @cbind zS = event REQ_NEW_WINDOW \@(echo "$UZBL_URI" | sed -e 's/^http:/https:/')\@ 328 329 # Yanking & pasting binds 330 @cbind yu = sh 'echo -n "$UZBL_URI" | xclip' 331 @cbind yU = sh 'echo -n "$1" | xclip' '\@SELECTED_URI' 332 @cbind yy = sh 'echo -n "$UZBL_TITLE" | xclip' 333 @cbind ys = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('returnuri') >\@ clipboard 334 335 # Clone current window 336 @cbind c = event REQ_NEW_WINDOW \@uri 337 # Go the page from primary selection 338 @cbind p = sh 'echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"' 339 # Go to the page in clipboard 340 @cbind P = sh 'echo "uri $(xclip -selection clipboard -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"' 341 # Start a new uzbl instance from the page in primary selection 342 @cbind 'p = sh 'echo "event REQ_NEW_WINDOW $(xclip -o)" > "$UZBL_FIFO"' 343 # paste primary selection into keycmd at the cursor position 344 @bind <Shift><Insert> = sh 'echo "event INJECT_KEYCMD $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"' 345 346 # Bookmark inserting binds 347 @cbind <Ctrl>m<tags:>_ = sh 'echo "$UZBL_URI $1" >> "$XDG_DATA_HOME"/uzbl/bookmarks' '%s' 348 # Or use a script to insert a bookmark. 349 @cbind M = spawn @scripts_dir/insert_bookmark.sh 350 351 # Bookmark/history loading 352 @cbind U = spawn @scripts_dir/load_url_from_history.sh 353 @cbind u = spawn @scripts_dir/load_url_from_bookmarks.sh 354 355 # Temporary bookmarks 356 #@cbind <Ctrl>d = spawn @scripts_dir/insert_temp.sh 357 #@cbind D = spawn @scripts_dir/load_url_from_temps.sh 358 359 # Link following (similar to vimperator and konqueror) 360 # Set custom keys you wish to use for navigation. Some common examples: 361 set follow_hint_keys = 0123456789 362 #set follow_hint_keys = qwerty 363 #set follow_hint_keys = asdfghjkl; 364 #set follow_hint_keys = thsnd-rcgmvwb/;789aefijkopquxyz234 365 @cbind f* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 'click') >\@ 366 @cbind F* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 'newwindow') >\@ 367 @cbind f* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 'returnuri') >\@ set 368 @cbind F* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 'returnuri') >\@ clipboard 369 @cbind fi = spawn @scripts_dir/go_input.sh 370 371 @cbind fs = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('returnuri') >\@ set 372 @cbind fS = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('click') >\@ 373 @cbind Fs = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('newwindow') >\@ 374 @cbind FS = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('returnuri') >\@ clipboard 375 376 @cbind ft* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'returnuri') >\@ set 377 @cbind fT* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'click') >\@ 378 @cbind Ft* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'newwindow') >\@ 379 @cbind FT* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'returnuri') >\@ clipboard 380 381 @cbind '* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'click') >\@ 382 383 # Form filler binds 384 # This script allows you to configure (per domain) values to fill in form 385 # fields (eg login information) and to fill in these values automatically. 386 # This implementation allows you to save multiple profiles for each form 387 # (think about multiple accounts on some website). 388 set formfiller = spawn @scripts_dir/formfiller.sh 389 @cbind ze = @formfiller edit 390 @cbind zn = @formfiller new 391 @cbind zl = @formfiller load 392 @cbind zo = @formfiller once 393 394 # --- Uzbl tabbed binds ------------------------------------------------------ 395 396 # Tab opening 397 @cbind gn = event NEW_TAB 398 @cbind gN = event NEW_TAB_NEXT 399 #@cbind go<uri:>_ = event NEW_TAB %s 400 #@cbind gO<uri:>_ = event NEW_TAB_NEXT %s 401 402 # Closing / resting 403 @cbind gC = exit 404 @cbind gQ = event CLEAN_TABS 405 406 # Tab navigating 407 @cbind g< = event FIRST_TAB 408 @cbind g> = event LAST_TAB 409 @cbind gt = event NEXT_TAB 410 @cbind gT = event PREV_TAB 411 @cbind gi<index:>_ = event GOTO_TAB %s 412 413 # Preset loading 414 set preset = event PRESET_TABS 415 @cbind gs<preset save:>_ = @preset save %s 416 @cbind glo<preset load:>_ = @preset load %s 417 @cbind gd<preset del:>_ = @preset del %s 418 # This doesn't work right now. 419 #@cbind gli = @preset list 420 421 # === Context menu items ===================================================== 422 423 # Default context menu 424 menu_add Google = set uri = http://google.com 425 menu_add Go Home = set uri = http://uzbl.org 426 menu_separator separator_1 427 menu_add Quit uzbl = exit 428 429 # Link context menu 430 menu_link_add Print Link = print \@SELECTED_URI 431 432 # === Mode configuration ===================================================== 433 434 # Define some mode specific uzbl configurations. 435 set command = @mode_config command 436 set insert = @mode_config insert 437 set stack = @mode_config stack 438 439 # Command mode config. 440 @command keycmd_style = foreground="red" 441 @command status_background = #202020 442 @command mode_indicator = Cmd 443 @command keycmd_events = 1 444 @command forward_keys = 0 445 @command modcmd_updates = 1 446 447 # Insert mode config. 448 @insert status_background = #303030 449 @insert mode_indicator = Ins 450 @insert forward_keys = 1 451 @insert keycmd_events = 0 452 @insert modcmd_updates = 0 453 454 # Multi-stage-binding mode config. 455 @stack keycmd_style = foreground="red" 456 @stack status_background = #202020 457 @stack mode_indicator = Bnd 458 @stack prompt_style = foreground="#888" weight="light" 459 @stack keycmd_events = 1 460 @stack modcmd_updates = 1 461 @stack forward_keys = 0 462 463 set default_mode = command 464 465 # === Post-load misc commands ================================================ 466 sync_spawn_exec @scripts_dir/load_cookies.sh 467 sync_spawn_exec @scripts_dir/load_cookies.sh @data_home/uzbl/session-cookies.txt 468 469 # Set the "home" page. 470 set uri = uzbl.org/doesitwork/@COMMIT 471 472 # vim: set fdm=syntax: