diff options
author | David Keijser <keijser@gmail.com> | 2010-03-20 13:45:43 +0100 |
---|---|---|
committer | David Keijser <keijser@gmail.com> | 2010-03-20 13:45:43 +0100 |
commit | fb9a2dd87d9539f43c92f128fa3d2362f2788976 (patch) | |
tree | 250e0d7e1815f0b94e863a3080edb1116b624568 /examples/config | |
parent | 3ed446e2081e8f133899b3ea5553e86765519238 (diff) | |
parent | e987cca0ce4808f18977183de5fced459ceee580 (diff) |
Merge branch 'master' of git://github.com/Dieterbe/uzbl into history
Diffstat (limited to 'examples/config')
-rw-r--r-- | examples/config/config | 108 |
1 files changed, 57 insertions, 51 deletions
diff --git a/examples/config/config b/examples/config/config index bee00ff..b30d216 100644 --- a/examples/config/config +++ b/examples/config/config @@ -34,8 +34,6 @@ 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 =============================================================== @@ -45,11 +43,12 @@ set jsh = js var run=Uzbl.run; function get(k){return run("print \\\@"+k)}; func # 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 +set authentication_handler = sync_spawn @scripts_dir/auth.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' +set new_window = sh 'uzbl-browser -u "$8"' # --- Optional dynamic event handlers ---------------------------------------- @@ -58,21 +57,16 @@ set new_window = sh 'uzbl-browser -u $8' # Load start handler @on_event LOAD_START @set_status <span foreground="khaki">wait</span> +# Reset the keycmd on navigation +@on_event LOAD_START @set_mode # 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 @@ -81,6 +75,7 @@ set new_window = sh 'uzbl-browser -u $8' # Example CONFIG_CHANGED event handler #@on_event CONFIG_CHANGED print Config changed: %1 = %2 + # === Behaviour and appearance =============================================== set show_status = 1 @@ -163,11 +158,13 @@ set ebind = @mode_bind global,-insert # === Global & keycmd editing binds ========================================== # Resets keycmd and returns to default mode. -@bind <Escape> = @set_mode +@on_event ESCAPE @set_mode +@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 +@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 + @@ -191,12 +188,8 @@ set ebind = @mode_bind global,-insert # === 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"); } +# Middle click open in new window +@bind <Button2> = sh 'if [ "\@SELECTED_URI" ]; then uzbl-browser -u "\@SELECTED_URI"; else echo "uri $(xclip -o | sed s/\\\@/%40/g)" > $4; fi' # === Keyboard bindings ====================================================== @@ -229,8 +222,8 @@ set open_new_window = sh 'uzbl-browser -u \@SELECTED_URI' @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 1 = set zoom_level = 1.0 +@cbind 2 = set zoom_level = 2.0 # --- Appearance binds --- @cbind t = toggle_status @@ -242,6 +235,29 @@ set open_new_window = sh 'uzbl-browser -u \@SELECTED_URI' @cbind n = search @cbind N = search_reverse +# --- Uzbl tabbed binds --- +# Tab opening +@cbind gn = event NEW_TAB +@cbind gN = event NEW_TAB_NEXT +@cbind go<uri:>_ = event NEW_TAB %s +@cbind gO<uri:>_ = event NEW_TAB_NEXT %s +@cbind gY = sh 'echo "event NEW_TAB `xclip -selection primary -o | sed s/\\\@/%40/g`" > $4' +# Closing / resting +@cbind gC = exit +@cbind gQ = event CLEAN_TABS +# Tab navigating +@cbind g< = event FIRST_TAB +@cbind g> = event LAST_TAB +@cbind gt = event NEXT_TAB +@cbind gT = event PREV_TAB +@cbind gi<index:>_ = event GOTO_TAB %s +# Preset loading +set preset = event PRESET_TABS +@cbind gs<preset save:>_ = @preset save %s +@cbind glo<preset load:>_ = @preset load %s +@cbind gd<preset del:>_ = @preset del %s +@cbind gli = @preset list + # --- 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 @@ -254,9 +270,11 @@ set open_new_window = sh 'uzbl-browser -u \@SELECTED_URI' @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 +# Reload all variables in the config +@cbind !reload = sh "sed '/^# === Post-load misc commands/,$d' $1 | grep '^set ' > $4" + +# 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:$5 -"' #@cbind <Ctrl><Alt>t = sh 'urxvt -e socat unix-connect:$5 -' @@ -278,12 +296,13 @@ set toggle_cmd_ins = @toggle_modes command insert @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'); +@cbind yu = sh 'echo -n $6 | xclip' +@cbind yy = sh 'echo -n $7 | xclip' # Go the page from primary selection -@cbind p = sh 'echo "uri `xclip -selection primary -o`" > $4' +@cbind p = sh 'echo "uri `xclip -selection primary -o | sed s/\\\@/%40/g`" > $4' # Go to the page in clipboard -@cbind P = sh 'echo "uri `xclip -selection clipboard -o`" > $4' +@cbind P = sh 'echo "uri `xclip -selection clipboard -o | sed s/\\\@/%40/g`" > $4' # Start a new uzbl instance from the page in primary selection @cbind 'p = sh 'exec uzbl-browser --uri $(xclip -o)' @@ -298,41 +317,28 @@ set toggle_cmd_ins = @toggle_modes command insert # --- Link following (similar to vimperator and konqueror) --- # Set custom keys you wish to use for navigation. Some common examples: -set follow_hint_keys = qwerty +set follow_hint_keys = 0123456789 +#set follow_hint_keys = qwerty #set follow_hint_keys = asdfghjkl; #set follow_hint_keys = thsnd-rcgmvwb/;789aefijkopquxyz234 -@cbind f* = script @scripts_dir/follow.js '%s @{follow_hint_keys}' +@cbind fl* = script @scripts_dir/follow.js '@follow_hint_keys %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 +# 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"' -# 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 ===================================================== |