X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fopenbox.c;h=277294d0c09c28f5bf0092e38a6edc7678dc24b0;hb=a5005506a89ecffe13e04cbcda5c20a2fa6ba25d;hp=0c74b255bae8fdef00a64f4b54c8bacf975b064c;hpb=b77a03a1f22e3e474c1338416ec30681c6216b0d;p=chaz%2Fopenbox diff --git a/openbox/openbox.c b/openbox/openbox.c index 0c74b255..277294d0 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -36,6 +36,7 @@ #include "focus_cycle_popup.h" #include "moveresize.h" #include "frame.h" +#include "framerender.h" #include "keyboard.h" #include "mouse.h" #include "extensions.h" @@ -45,6 +46,7 @@ #include "config.h" #include "ping.h" #include "mainloop.h" +#include "prompt.h" #include "gettext.h" #include "parser/parse.h" #include "render/render.h" @@ -106,6 +108,7 @@ static KeyCode keys[OB_NUM_KEYS]; static gint exitcode = 0; static guint remote_control = 0; static gboolean being_replaced = FALSE; +static gchar *config_file = NULL; static void signal_handler(gint signal, gpointer data); static void remove_args(gint *argc, gchar **argv, gint index, gint num); @@ -193,7 +196,7 @@ gint main(gint argc, gchar **argv) /* set the DISPLAY environment variable for any lauched children, to the display we're using, so they open in the right place. */ - putenv(g_strdup_printf("DISPLAY=%s", DisplayString(ob_display))); + setenv("DISPLAY", DisplayString(ob_display), TRUE); /* create available cursors */ cursors[OB_CURSOR_NONE] = None; @@ -245,17 +248,26 @@ gint main(gint argc, gchar **argv) config_startup(i); /* parse/load user options */ - if (parse_load_rc(NULL, &doc, &node)) { + if (parse_load_rc(config_file, &doc, &node)) { parse_tree(i, doc, node->xmlChildrenNode); parse_close(doc); - } else + } + else { g_message(_("Unable to find a valid config file, using some simple defaults")); + config_file = NULL; + } -/* - if (config_type != NULL) - PROP_SETS(RootWindow(ob_display, ob_screen), - ob_config, config_type); -*/ + if (config_file) { + gchar *p = g_filename_to_utf8(config_file, -1, + NULL, NULL, NULL); + if (p) + PROP_SETS(RootWindow(ob_display, ob_screen), + ob_config_file, p); + g_free(p); + } + else + PROP_ERASE(RootWindow(ob_display, ob_screen), + ob_config_file); /* we're done with parsing now, kill it */ parse_shutdown(i); @@ -303,6 +315,7 @@ gint main(gint argc, gchar **argv) grab_startup(reconfigure); group_startup(reconfigure); ping_startup(reconfigure); + prompt_startup(reconfigure); client_startup(reconfigure); dock_startup(reconfigure); moveresize_startup(reconfigure); @@ -362,6 +375,7 @@ gint main(gint argc, gchar **argv) moveresize_shutdown(reconfigure); dock_shutdown(reconfigure); client_shutdown(reconfigure); + prompt_shutdown(reconfigure); ping_shutdown(reconfigure); group_shutdown(reconfigure); grab_shutdown(reconfigure); @@ -488,6 +502,7 @@ static void print_help() g_print(_(" --help Display this help and exit\n")); g_print(_(" --version Display the version and exit\n")); g_print(_(" --replace Replace the currently running window manager\n")); + g_print(_(" --config-file FILE Specify the path to the config file to use\n")); g_print(_(" --sm-disable Disable connection to the session manager\n")); g_print(_("\nPassing messages to a running Openbox instance:\n")); g_print(_(" --reconfigure Reload Openbox's configuration\n")); @@ -515,7 +530,7 @@ static void remove_args(gint *argc, gchar **argv, gint index, gint num) static void parse_env() { /* unset this so we don't pass it on unknowingly */ - putenv(g_strdup("DESKTOP_STARTUP_ID")); + unsetenv("DESKTOP_STARTUP_ID"); } static void parse_args(gint *argc, gchar **argv) @@ -565,6 +580,17 @@ static void parse_args(gint *argc, gchar **argv) else if (!strcmp(argv[i], "--exit")) { remote_control = 3; } + else if (!strcmp(argv[i], "--config-file")) { + if (i == *argc - 1) /* no args left */ + g_printerr(_("--config-file requires an argument\n")); + else { + /* this will be in the current locale encoding, which is + what we want */ + config_file = argv[i+1]; + ++i; /* skip the argument */ + ob_debug("--config-file %s\n", config_file); + } + } else if (!strcmp(argv[i], "--sm-save-file")) { if (i == *argc - 1) /* no args left */ /* not translated cuz it's sekret */