support for some default settings so that uzbl is more uzbl by default (without confi...
authorDieter Plaetinck <dieter@plaetinck.be>
Thu, 21 May 2009 19:15:27 +0000 (21:15 +0200)
committerDieter Plaetinck <dieter@plaetinck.be>
Thu, 21 May 2009 19:15:27 +0000 (21:15 +0200)
Makefile
README
config.h [new file with mode: 0644]
docs/FAQ
docs/TODO
uzbl.c
uzbl.h

index d472720..fe6f73a 100644 (file)
--- 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 (file)
--- 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 <filename>: <filename> 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 (file)
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 = <span background=\"darkblue\" foreground=\"white\"> MODE </span> <span background=\"red\" foreground=\"white\">KEYCMD</span> (LOAD_PROGRESS%)  <b>TITLE</b>  - Uzbl browser"},
+{ "set title_format_long = KEYCMD MODE TITLE - Uzbl browser <NAME> > SELECTED_URI"},
+{ "set title_format_short = TITLE - Uzbl browser <NAME>"},
+{ NULL   }
+};
index e3652f9..431675e 100644 (file)
--- 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 ?
index 8d7994d..0b0e035 100644 (file)
--- 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 (file)
--- a/uzbl.c
+++ b/uzbl.c
@@ -54,7 +54,7 @@
 #include <libsoup/soup.h>
 #include <signal.h>
 #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 (file)
--- a/uzbl.h
+++ b/uzbl.h
@@ -11,9 +11,6 @@
  *
  */
 
-#define STATUS_DEFAULT "<span background=\"darkblue\" foreground=\"white\"> MODE </span> <span background=\"red\" foreground=\"white\">KEYCMD</span> (LOAD_PROGRESS%)  <b>TITLE</b>  - Uzbl browser"
-#define TITLE_LONG_DEFAULT "KEYCMD MODE TITLE - Uzbl browser <NAME> > SELECTED_URI"
-#define TITLE_SHORT_DEFAULT "TITLE - Uzbl browser <NAME>"
 #define NOSPLIT ((void*)1)
 
 enum {