From 92ccf67e010bcff1a153dd67093c23300c2ce47f Mon Sep 17 00:00:00 2001 From: Mason Larobina Date: Sat, 26 Dec 2009 19:27:56 +0800 Subject: URIEncode search string component of web searching binds. --- examples/config/uzbl/config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/config/uzbl/config') diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config index 9dc4a35..a6be6d6 100644 --- a/examples/config/uzbl/config +++ b/examples/config/uzbl/config @@ -230,9 +230,9 @@ set open_new_window = sh 'uzbl-browser -u \@SELECTED_URI' @cbind N = search_reverse # --- Web searching binds --- -@cbind gg_ = uri http://www.google.com/search?q=%s -@cbind \\awiki_ = uri http://wiki.archlinux.org/index.php/Special:Search?search=%s&go=Go -@cbind \\wiki_ = uri http://en.wikipedia.org/w/index.php?title=Special:Search&search=%s&go=Go +@cbind gg_ = uri http://www.google.com/search?q=\@\@ +@cbind \\awiki_ = uri http://wiki.archlinux.org/index.php/Special:Search?search=\@\@&go=Go +@cbind \\wiki_ = uri http://en.wikipedia.org/w/index.php?title=Special:Search&search=\@\@&go=Go # --- Handy binds --- # Set function shortcut -- cgit v1.2.3 From 3733d86d0d28e072697a17a43eff360dcdac8038 Mon Sep 17 00:00:00 2001 From: Mason Larobina Date: Sat, 26 Dec 2009 20:53:24 +0800 Subject: Keycmd plugin now sets raw_{key,mod}cmd vars and updated title format. --- examples/config/uzbl/config | 2 ++ examples/data/uzbl/plugins/keycmd.py | 25 +++++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'examples/config/uzbl/config') diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config index a6be6d6..072c045 100644 --- a/examples/config/uzbl/config +++ b/examples/config/uzbl/config @@ -96,6 +96,8 @@ set selected_section = \@[\@SELECTED_URI]\@ set status_format = @mode_section @keycmd_section @progress_section @uri_section @name_section @status_section @scroll_section @selected_section +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, diff --git a/examples/data/uzbl/plugins/keycmd.py b/examples/data/uzbl/plugins/keycmd.py index af6beff..8475c1d 100644 --- a/examples/data/uzbl/plugins/keycmd.py +++ b/examples/data/uzbl/plugins/keycmd.py @@ -10,20 +10,18 @@ UZBLS = {} # Keycmd format which includes the markup for the cursor. KEYCMD_FORMAT = "%s%s%s" +MODCMD_FORMAT = " %s " -def uzbl_escape(str): - '''Prevent outgoing keycmd values from expanding inside the - status_format.''' +def escape(str): + for char in ['\\', '@']: + str = str.replace(char, '\\'+char) - if not str: - return '' + return str - for char in ['\\', '@']: - if char in str: - str = str.replace(char, '\\'+char) - return "@[%s]@" % str +def uzbl_escape(str): + return "@[%s]@" % escape(str) if str else '' class Keylet(object): @@ -261,6 +259,7 @@ def clear_keycmd(uzbl): k.cursor = 0 k._repr_cache = False uzbl.set('keycmd') + uzbl.set('raw_keycmd') uzbl.event('KEYCMD_CLEARED') @@ -276,6 +275,7 @@ def clear_modcmd(uzbl, clear_held=False): k.held = set() uzbl.set('modcmd') + uzbl.set('raw_modcmd') uzbl.event('MODCMD_CLEARED') @@ -314,9 +314,11 @@ def update_event(uzbl, k, execute=True): new_modcmd = k.get_modcmd() if not new_modcmd: uzbl.set('modcmd', config=config) + uzbl.set('raw_modcmd', config=config) elif new_modcmd == modcmd: - uzbl.set('modcmd', ' %s ' % uzbl_escape(new_modcmd), + uzbl.set('raw_modcmd', escape(modcmd), config=config) + uzbl.set('modcmd', MODCMD_FORMAT % uzbl_escape(modcmd), config=config) if 'keycmd_events' in config and config['keycmd_events'] != '1': @@ -325,6 +327,7 @@ def update_event(uzbl, k, execute=True): new_keycmd = k.get_keycmd() if not new_keycmd: uzbl.set('keycmd', config=config) + uzbl.set('raw_keycmd', config=config) elif new_keycmd == keycmd: # Generate the pango markup for the cursor in the keycmd. @@ -332,6 +335,7 @@ def update_event(uzbl, k, execute=True): chunks = [keycmd[:k.cursor], curchar, keycmd[k.cursor+1:]] value = KEYCMD_FORMAT % tuple(map(uzbl_escape, chunks)) uzbl.set('keycmd', value, config=config) + uzbl.set('raw_keycmd', escape(keycmd), config=config) def inject_str(str, index, inj): @@ -391,6 +395,7 @@ def key_press(uzbl, key): k.keycmd = '' k.cursor = 0 uzbl.set('keycmd', config=config) + uzbl.set('raw_keycmd', config=config) return k.keycmd = inject_str(k.keycmd, k.cursor, key) -- cgit v1.2.3 From 3a73a42aae448240211d6d96349f1afb7e4e4996 Mon Sep 17 00:00:00 2001 From: Mason Larobina Date: Fri, 1 Jan 2010 09:29:34 +0800 Subject: Add 'uzbl terminal' binding & remove old example lines. --- examples/config/uzbl/config | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'examples/config/uzbl/config') diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config index 072c045..9d0f710 100644 --- a/examples/config/uzbl/config +++ b/examples/config/uzbl/config @@ -245,6 +245,9 @@ set open_new_window = sh 'uzbl-browser -u \@SELECTED_URI' @cbind !dump = sh "echo dump_config > $4" # Reload config @cbind !reload = sh "sed '/^# === Post-load misc commands/,$d' $1 > $4" +# Uzbl Terminal +@cbind t = sh 'xterm -e "socat unix-connect:$5 -"' +#@cbind t = sh 'urxvt -e socat unix-connect:$5 -' # --- Uri opening prompts --- @cbind o_ = uri %s @@ -287,17 +290,6 @@ set toggle_cmd_ins = @toggle_modes command insert # Or number with strings instead of numbers: @cbind fL* = script @scripts_dir/follow_Numbers_Strings.js %s - -@cbind 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 -# The body of the shell command should be one parameter, so if it has spaces like here, -# you must enclose it in quotes. Remember to escape (and double-escape) quotes and backslashes -# in the body. Any additional parameters you use will appear AFTER the default parameters (cfg file -# path, fifo & socket dirs, etc.) -@cbind XS = sh 'echo "js alert (\\"This is sent by the shell via a fifo\\")" > "$4"' - # --- 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 -- cgit v1.2.3 From 759143756ff5ab9076b5d9e1a3839d1e8690ede2 Mon Sep 17 00:00:00 2001 From: Mason Larobina Date: Fri, 1 Jan 2010 21:29:16 +0800 Subject: We don't have support for inline comments. --- examples/config/uzbl/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/config/uzbl/config') diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config index 9d0f710..bf08c9e 100644 --- a/examples/config/uzbl/config +++ b/examples/config/uzbl/config @@ -45,7 +45,7 @@ set scheme_handler = sync_spawn @scripts_dir/scheme.py # New window handler options #set new_window = sh 'echo uri "$8" > $4' # open in same window -set new_window = sh 'uzbl-browser -u $8' # equivalent to the default behaviour +set new_window = sh 'uzbl-browser -u $8' # Load start handlers @on_event LOAD_START @set_status wait -- cgit v1.2.3 From 0482aae0aed75e333225c45312c260f63a888517 Mon Sep 17 00:00:00 2001 From: Mason Larobina Date: Sat, 2 Jan 2010 20:53:07 +0800 Subject: Updated comments in handlers section and updated the download handler --- examples/config/uzbl/config | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'examples/config/uzbl/config') diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config index bf08c9e..4782a0d 100644 --- a/examples/config/uzbl/config +++ b/examples/config/uzbl/config @@ -39,15 +39,24 @@ set jsh = js var run=Uzbl.run; function get(k){return run("print \\\@"+k)}; func # === Handlers =============================================================== -set download_handler = spawn @scripts_dir/download.sh -set cookie_handler = talk_to_socket $XDG_CACHE_HOME/uzbl/cookie_daemon_socket -set scheme_handler = sync_spawn @scripts_dir/scheme.py +# --- Hardcoded event handlers ----------------------------------------------- -# New window handler options -#set new_window = sh 'echo uri "$8" > $4' # open in same window -set new_window = sh 'uzbl-browser -u $8' +# 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 -# Load start handlers +# Open in the same window. +#set new_window = sh 'echo uri "$8" > $4' +# Open a link in a new window. +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 wait # Load commit handlers @@ -69,7 +78,7 @@ set new_window = sh 'uzbl-browser -u $8' # Switch to command mode if anything else is clicked @on_event ROOT_ACTIVE @set_mode command -# Misc on_event handlers +# Example CONFIG_CHANGED event handler #@on_event CONFIG_CHANGED print Config changed: %1 = %2 # === Behaviour and appearance =============================================== -- cgit v1.2.3 From a5f014de5f76169a38ee67e46a0526e5d80a3433 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 2 Jan 2010 18:08:16 +0100 Subject: add notes into example config --- examples/config/uzbl/config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/config/uzbl/config') diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config index 4782a0d..3edb36c 100644 --- a/examples/config/uzbl/config +++ b/examples/config/uzbl/config @@ -48,7 +48,7 @@ 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. +# Open a link in a new window. equivalent to default behavior set new_window = sh 'uzbl-browser -u $8' # --- Optional dynamic event handlers ---------------------------------------- @@ -254,7 +254,7 @@ set open_new_window = sh 'uzbl-browser -u \@SELECTED_URI' @cbind !dump = sh "echo dump_config > $4" # Reload config @cbind !reload = sh "sed '/^# === Post-load misc commands/,$d' $1 > $4" -# Uzbl Terminal +# Uzbl Terminal. TODO explain why this is useful @cbind t = sh 'xterm -e "socat unix-connect:$5 -"' #@cbind t = sh 'urxvt -e socat unix-connect:$5 -' -- cgit v1.2.3