diff options
author | 2009-05-17 15:46:22 -0500 | |
---|---|---|
committer | 2009-05-17 15:46:22 -0500 | |
commit | cd7b17796013f1afcdedc9e39ca4565ecdd57fd1 (patch) | |
tree | 04ec48b14d88cde3e69a0000cc88d435ec0d5d23 | |
parent | 7dc4f6757170638977d8a0a2fd8ef6fbd4bc7c8d (diff) | |
parent | 8ed329a044b35a5db60f0c54e372c24cb1b97179 (diff) |
Merge branch 'experimental' of git://github.com/Dieterbe/uzbl
-rw-r--r-- | README | 85 | ||||
-rw-r--r-- | docs/CONTRIBUTING | 5 | ||||
-rw-r--r-- | docs/TODO | 2 | ||||
-rw-r--r-- | examples/configs/sampleconfig | 6 | ||||
-rw-r--r-- | examples/configs/sampleconfig-dev | 6 | ||||
-rw-r--r-- | uzbl.c | 19 |
6 files changed, 118 insertions, 5 deletions
@@ -81,7 +81,90 @@ When uzbl forks a new instance (eg "open in new window") it will use the same co If you made changes to the configuration at runtime, these are not pased on to the child. ### COMMAND SYNTAX -TODO +Commands are used for: + +* creating keybindings +* altering variables +* getting the values of variables +* running actions +* setting the input buffer + +Uzbl will read commands via standard input, named fifo pipe (if `fifo_dir` is set) and IPC socket (when `socket_dir` is set). +For convenience, uzbl can also be instructed to read commands from a file on startup by using the `-c` option. Indeed, the config file is nothing more than a list of commands. + +Each command starts with the name of the command, which must be the first thing on a line; preceding whitespace is not allowed. +A command is terminated by a newline. Empty lines and lines that start with the hash sign are ignored by the parser. Command names are not case sensitive. + +The following commands are recognized: + + SET <key> = <value> +Set is used for changing variables. Every variable can be changed on the fly and for some variables, some additional logic is performed. +For example, setting the variable `uri` will make uzbl start loading it, and changing the format of the statusbar/windowtitle/user agent/.. will be effective immediately. +If you want to unset a string, use SET with one space after the equals sign. + + GET <key> +Use this to print the value of a key. (and TODO, get the value through the socket) + + BIND <string> = <action> +Makes the character sequence `<string>` invoke `<action>` when typed interactively in uzbl. +There are a few tricks you can do: + +* `<string>` ends with an underscore: the action will only be invoked after pressing return/enter. If the user enters text where `<string>` has the underscore, `%s` in the `<action>` string will be replaced by this text. (optional) +* `<string>` ends with an asterisk: similar behavior as with an underscore, but also makes the binding incremental (i.e. the action will be invoked on every keystroke). +* `<string>` ends on a different character: you need to type the full string, which will trigger the action immediately, without pressing enter/return. + +Examples: + + # uzbl will load the url when you type: 'o <url><enter>' + bind o _ = uri %s + # a search action which is called on every character typed after the slash, letting you see the search narrow down while typing. + # Hitting return, enter or esc will terminate the search. + bind /* = search %s + # when you type `ZZ` and nothing else, the exit action will be triggered immediately. + bind ZZ = exit + + ACT <action> +This tells uzbl to execute an action immediately. The simplest example of this would be `act exit`; you know what that'll do. + + KEYCMD <string> +This sets the interactive command buffer to `<string>`. Keycmd is primarily useful for scripts that help you type a command while still letting you edit it before execution. +For example, if you have a binding like "o _" that opens an URL, then you could create a binding `O` that spawns a script which will set the command buffer to "o current-uri-here", letting you enter relative URLs easily. +(See sample config) + +### ACTIONS +Actions are invoked via bindings and by the ACT command. Most actions are self-explanatory, though a few need to be clarified. A list of +actions follows: + +* `back` +* `forward` +* `scroll_vert <amount>` +* `scroll_horz <amount>` +* `scroll_begin` +* `scroll_end` +* `reload` +* `reload_ign_cache` +* `stop` +* `zoom_in` +* `zoom_out` +* `uri <address>` +* `script <body>` + - execute the javascript in `<body>` + - remember that the commands, and thus actions, must not contain line breaks +* `toggle_status` +* `spawn <executable> <additonal args>` + - runs a command; see EXTERNAL SCRIPTS for details + - PATH is searched so giving the full path to commands is not neccessary + - note that the arguments as specified in "EXTERNAL SCRIPTS" are appended at the end, so the argument numbers will be higher. +* `sh <command>` + - runs a shell command by expanding `%s` in the `shell_cmd` variable with the specified command; primarily useful as a shortcut for `spawn sh -c <body>` + - note that the arguments as specified in "EXTERNAL SCRIPTS" are appended at the end, so the argument numbers will be higher. +* `exit` +* `search <string>` +* `search_reverse <string>` +* `insert_mode` +* `runcmd` + - can be used for running a command such as SET or BIND + ### VARIABLE REPLACEMENT Some of the variables are interpreted: diff --git a/docs/CONTRIBUTING b/docs/CONTRIBUTING index 196cda4..f351da9 100644 --- a/docs/CONTRIBUTING +++ b/docs/CONTRIBUTING @@ -20,6 +20,11 @@ workable then submitting plain patches. Git is good in merging in branches even if the base code has changed in the meanwhile. This does not work with patches. +If you're new to Git/github, have no fear: + +* [Github guides (highly recommended)](http://github.com/guides/home) +* [Guides: Fork a project and submit your modifications](http://github.com/guides/fork-a-project-and-submit-your-modifications) + ### VALGRIND PROFILING $ add this to Makefile header: CFLAGS=-g $ recompile @@ -7,7 +7,7 @@ More or less in order of importance/urgency * split up uzbl.c into multiple files * define a basic, simple default config so uzbl is a bit uzbl by default * shortcuts to focus other instances (see docs/multiple-instances-management) - +* password handler (manager) * recognize -h with GOption? * implement a vimperator-like link following scheme. diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index 7a94b19..81e6701 100644 --- a/examples/configs/sampleconfig +++ b/examples/configs/sampleconfig @@ -84,6 +84,12 @@ bind u = spawn /usr/share/uzbl/examples/scripts/load_url_from_bookmar # with the sample yank script, you can yank one of the arguments into clipboard/selection bind yurl = spawn /usr/share/uzbl/examples/scripts/yank.sh 8 primary bind ytitle = spawn /usr/share/uzbl/examples/scripts/yank.sh 9 clipboard +# does the same as yurl but without needing a script +bind y2url = sh 'echo -n $6 | xclip' +# go the page from primary selection +bind p = sh "echo act uri `xclip -selection primary -o` > $4" +# go to the page in clipboard +bind P = sh "echo act uri `xclip -selection clipboard -o` > $4" bind ZZ = exit bind S = script alert("hi"); # example showing how to use sh diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index 31b49ab..7126cf4 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -85,6 +85,12 @@ bind u = spawn ./examples/scripts/load_url_from_bookmarks.sh # with the sample yank script, you can yank one of the arguments into clipboard/selection bind yurl = spawn ./examples/scripts/yank.sh 8 primary bind ytitle = spawn ./examples/scripts/yank.sh 9 clipboard +# does the same as yurl but without needing a script +bind y2url = sh 'echo -n $6 | xclip' +# go the page from primary selection +bind p = sh "echo act uri `xclip -selection primary -o` > $4" +# go to the page in clipboard +bind P = sh "echo act uri `xclip -selection clipboard -o` > $4" bind ZZ = exit bind S = script alert("hi"); # example showing how to use sh @@ -834,10 +834,23 @@ get_var_value(gchar *name) { void **p = NULL; if( (p = g_hash_table_lookup(uzbl.comm.proto_var, name)) ) { - if(var_is("status_format", name) - || var_is("useragent", name) + if(var_is("uri", name) + || var_is("status_message", name) + || var_is("status_format", name) + || var_is("status_background", name) || var_is("title_format_short", name) - || var_is("title_format_long", name)) { + || var_is("title_format_long", name) + || var_is("modkey", name) + || var_is("load_finish_handler", name) + || var_is("history_handler", name) + || var_is("download_handler", name) + || var_is("cookie_handler", name) + || var_is("fifo_dir", name) + || var_is("socket_dir", name) + || var_is("shell_cmd", name) + || var_is("proxy_url", name) + || var_is("useragent", name)) + { printf("VAR: %s VALUE: %s\n", name, (char *)*p); } else printf("VAR: %s VALUE: %d\n", name, (int)*p); } |