From 73dfcb6c632ecde7780e5e9bb53536b65bb0463b Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Thu, 21 May 2009 21:15:27 +0200 Subject: [PATCH] support for some default settings so that uzbl is more uzbl by default (without config file) --- Makefile | 1 + README | 5 +++-- config.h | 30 ++++++++++++++++++++++++++++++ docs/FAQ | 8 +++++--- docs/TODO | 1 - uzbl.c | 14 +++++--------- uzbl.h | 3 --- 7 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 config.h diff --git a/Makefile b/Makefile index d472720..fe6f73a 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,7 @@ install: install -D -m755 uzbl $(DESTDIR)/usr/bin/uzbl install -D -m755 uzblctrl $(DESTDIR)/usr/bin/uzblctrl cp -ax docs $(DESTDIR)/usr/share/uzbl/ + cp -ax config.h $(DESTDIR)/usr/share/uzbl/docs/ cp -ax examples $(DESTDIR)/usr/share/uzbl/ install -D -m644 AUTHORS $(DESTDIR)/usr/share/uzbl/docs install -D -m644 README $(DESTDIR)/usr/share/uzbl/docs diff --git a/README b/README index d0a615b..4eee02e 100644 --- a/README +++ b/README @@ -53,8 +53,9 @@ Time to change that! ### CONFIGURATION / CONTROL: -The general idea is that uzbl by default is very bare bones. you can send it commands to update settings and perform actions, through various interfaces. (TODO: some default settings) -For examples of the possibilities, please see the sample config(s). +The general idea is that uzbl by default is very bare bones. you can send it commands to update settings and perform actions, through various interfaces. +There is a limited default configuration. Please see config.h to see what it contains. +For examples of the possibilities what you can do, please see the sample config(s). There are several interfaces to interact with uzbl: * uzbl --config : will be read line by line, and the commands in it will be executed. useful to configure uzbl at startup. diff --git a/config.h b/config.h new file mode 100644 index 0000000..f954736 --- /dev/null +++ b/config.h @@ -0,0 +1,30 @@ +const struct { + char *command; +} default_config[] = { +{ "bind j = scroll_vert 20"}, +{ "bind k = scroll_vert -20"}, +{ "bind h = scroll_horz -20"}, +{ "bind l = scroll_horz 20"}, +{ "bind << = scroll_begin"}, +{ "bind >> = scroll_end"}, +{ "bind b = back"}, +{ "bind m = forward"}, +{ "bind s = stop "}, +{ "bind r = reload"}, +{ "bind R = reload_ign_cache"}, +{ "bind + = zoom_in"}, +{ "bind - = zoom_out"}, +{ "bind t = toggle_status"}, +{ "bind /* = search %s"}, +{ "bind ?* = search_reverse %s"}, +{ "bind n = search"}, +{ "bind N = search_reverse"}, +{ "bind o _ = uri %s"}, +{ "bind i = toggle_insert_mode"}, +{ "bind ZZ = exit"}, +{ "set reset_command_mode = 1"}, +{ "set status_format = MODE KEYCMD (LOAD_PROGRESS%) TITLE - Uzbl browser"}, +{ "set title_format_long = KEYCMD MODE TITLE - Uzbl browser > SELECTED_URI"}, +{ "set title_format_short = TITLE - Uzbl browser "}, +{ NULL } +}; diff --git a/docs/FAQ b/docs/FAQ index e3652f9..431675e 100644 --- a/docs/FAQ +++ b/docs/FAQ @@ -1,10 +1,12 @@ FAQ --- -### I just installed uzbl but it doesn't do much. I can load one uri and quit the program but that's it. -You did not load a configuration. Uzbl does not create a default config file on startup like some other programs do. +### I just installed uzbl but it doesn't do much. What now? +Uzbl does not create a default config file on startup like some other programs do. Because we want to give you the freedom to place your config where you want, and to use a config or not. -Have a look in /usr/share/uzbl/examples/configs. +Uzbl includes *some* default settings hardcoded, but these are rather limited (some navigation keybinds, statusbar settings, but no history/download handlers etc.) +Look at config.h to see the default settings. +Have a look in /usr/share/uzbl/examples/configs to see what you can do. You will probably want to create your own config based on an example config. Use the --config parameter or save your config as $XDG\_CONFIG\_HOME/uzbl/config to have it auto-loaded. ### Where is the location bar? How do I change the URL ? diff --git a/docs/TODO b/docs/TODO index 8d7994d..0b0e035 100644 --- a/docs/TODO +++ b/docs/TODO @@ -5,7 +5,6 @@ More or less in order of importance/urgency * allow to tag , to group instances together * store uri/tag/name/state in xorg window properties * 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) diff --git a/uzbl.c b/uzbl.c index 7c19034..bc1a77e 100644 --- a/uzbl.c +++ b/uzbl.c @@ -54,7 +54,7 @@ #include #include #include "uzbl.h" - +#include "config.h" static Uzbl uzbl; typedef void (*Command)(WebKitWebView*, GArray *argv); @@ -1805,7 +1805,10 @@ static void settings_init () { State *s = &uzbl.state; Network *n = &uzbl.net; - uzbl.behave.reset_command_mode = 1; + int i; + for (i = 0; default_config[i].command != NULL; i++) { + parse_cmd_line(default_config[i].command); + } if (!s->config_file) { s->config_file = find_xdg_file (0, "/uzbl/config"); @@ -1826,13 +1829,6 @@ settings_init () { if (uzbl.state.verbose) printf ("No configuration file loaded.\n"); } - if (!uzbl.behave.status_format) - set_var_value("status_format", STATUS_DEFAULT); - if (!uzbl.behave.title_format_long) - set_var_value("title_format_long", TITLE_LONG_DEFAULT); - if (!uzbl.behave.title_format_short) - set_var_value("title_format_short", TITLE_SHORT_DEFAULT); - g_signal_connect(n->soup_session, "request-queued", G_CALLBACK(handle_cookies), NULL); } diff --git a/uzbl.h b/uzbl.h index 5c3dc78..0440382 100644 --- a/uzbl.h +++ b/uzbl.h @@ -11,9 +11,6 @@ * */ -#define STATUS_DEFAULT " MODE KEYCMD (LOAD_PROGRESS%) TITLE - Uzbl browser" -#define TITLE_LONG_DEFAULT "KEYCMD MODE TITLE - Uzbl browser > SELECTED_URI" -#define TITLE_SHORT_DEFAULT "TITLE - Uzbl browser " #define NOSPLIT ((void*)1) enum { -- 1.7.9.5