change the --config-file to --config, which works differently..
change the _OPENBOX_RC root property to _OPENBOX_CONFIG which is also different.
This commit is contained in:
parent
37875f091d
commit
a6aaabe62c
6 changed files with 35 additions and 34 deletions
|
@ -92,7 +92,7 @@ static KeyCode keys[OB_NUM_KEYS];
|
||||||
static gint exitcode = 0;
|
static gint exitcode = 0;
|
||||||
static guint remote_control = 0;
|
static guint remote_control = 0;
|
||||||
static gboolean being_replaced = FALSE;
|
static gboolean being_replaced = FALSE;
|
||||||
static gchar *config_file = NULL;
|
static gchar *config_type = NULL;
|
||||||
|
|
||||||
static void signal_handler(gint signal, gpointer data);
|
static void signal_handler(gint signal, gpointer data);
|
||||||
static void parse_args(gint argc, gchar **argv);
|
static void parse_args(gint argc, gchar **argv);
|
||||||
|
@ -222,18 +222,21 @@ gint main(gint argc, gchar **argv)
|
||||||
of the rc */
|
of the rc */
|
||||||
i = parse_startup();
|
i = parse_startup();
|
||||||
|
|
||||||
|
/* start up config which sets up with the parser */
|
||||||
config_startup(i);
|
config_startup(i);
|
||||||
|
|
||||||
/* parse/load user options */
|
/* parse/load user options */
|
||||||
if (parse_load_rc(config_file, &doc, &node, &config_file)) {
|
if (parse_load_rc(config_type, &doc, &node)) {
|
||||||
PROP_SETS(RootWindow(ob_display, ob_screen),
|
|
||||||
openbox_rc, config_file);
|
|
||||||
parse_tree(i, doc, node->xmlChildrenNode);
|
parse_tree(i, doc, node->xmlChildrenNode);
|
||||||
} else {
|
parse_close(doc);
|
||||||
|
} else
|
||||||
g_message(_("Unable to find a valid config file, using some simple defaults"));
|
g_message(_("Unable to find a valid config file, using some simple defaults"));
|
||||||
PROP_ERASE(RootWindow(ob_display, ob_screen), openbox_rc);
|
|
||||||
}
|
if (config_type != NULL)
|
||||||
|
PROP_SETS(RootWindow(ob_display, ob_screen),
|
||||||
|
openbox_config, config_type);
|
||||||
|
|
||||||
/* we're done with parsing now, kill it */
|
/* we're done with parsing now, kill it */
|
||||||
parse_close(doc);
|
|
||||||
parse_shutdown(i);
|
parse_shutdown(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +332,6 @@ gint main(gint argc, gchar **argv)
|
||||||
|
|
||||||
XSync(ob_display, FALSE);
|
XSync(ob_display, FALSE);
|
||||||
|
|
||||||
g_free(config_file); /* this is set by parse_load_rc */
|
|
||||||
RrThemeFree(ob_rr_theme);
|
RrThemeFree(ob_rr_theme);
|
||||||
RrInstanceFree(ob_rr_inst);
|
RrInstanceFree(ob_rr_inst);
|
||||||
|
|
||||||
|
@ -404,7 +406,7 @@ static void print_help()
|
||||||
{
|
{
|
||||||
g_print(_("Syntax: openbox [options]\n"));
|
g_print(_("Syntax: openbox [options]\n"));
|
||||||
g_print(_("\nOptions:\n\n"));
|
g_print(_("\nOptions:\n\n"));
|
||||||
g_print(_(" --config-file FILE Specify the file to load for the config file\n"));
|
g_print(_(" --config TYPE Specify the configuration profile to use\n"));
|
||||||
#ifdef USE_SM
|
#ifdef USE_SM
|
||||||
g_print(_(" --sm-disable Disable connection to session manager\n"));
|
g_print(_(" --sm-disable Disable connection to session manager\n"));
|
||||||
g_print(_(" --sm-client-id ID Specify session management ID\n"));
|
g_print(_(" --sm-client-id ID Specify session management ID\n"));
|
||||||
|
@ -450,11 +452,11 @@ static void parse_args(gint argc, gchar **argv)
|
||||||
remote_control = 1;
|
remote_control = 1;
|
||||||
} else if (!strcmp(argv[i], "--restart")) {
|
} else if (!strcmp(argv[i], "--restart")) {
|
||||||
remote_control = 2;
|
remote_control = 2;
|
||||||
} else if (!strcmp(argv[i], "--config-file")) {
|
} else if (!strcmp(argv[i], "--config")) {
|
||||||
if (i == argc - 1) /* no args left */
|
if (i == argc - 1) /* no args left */
|
||||||
g_printerr(_("--config-file requires an argument\n"));
|
g_printerr(_("--config-file requires an argument\n"));
|
||||||
else {
|
else {
|
||||||
config_file = g_strdup(argv[i+1]);
|
config_type = g_strdup(argv[i+1]);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,7 @@ void prop_startup()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CREATE(openbox_pid, "_OPENBOX_PID");
|
CREATE(openbox_pid, "_OPENBOX_PID");
|
||||||
CREATE(openbox_rc, "_OPENBOX_RC");
|
CREATE(openbox_config, "_OPENBOX_CONFIG");
|
||||||
CREATE(openbox_wm_state_undecorated, "_OB_WM_STATE_UNDECORATED");
|
CREATE(openbox_wm_state_undecorated, "_OB_WM_STATE_UNDECORATED");
|
||||||
CREATE(openbox_control, "_OB_CONTROL");
|
CREATE(openbox_control, "_OB_CONTROL");
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ typedef struct Atoms {
|
||||||
|
|
||||||
Atom openbox_wm_state_undecorated;
|
Atom openbox_wm_state_undecorated;
|
||||||
Atom openbox_pid;
|
Atom openbox_pid;
|
||||||
Atom openbox_rc;
|
Atom openbox_config;
|
||||||
Atom openbox_control;
|
Atom openbox_control;
|
||||||
} Atoms;
|
} Atoms;
|
||||||
Atoms prop_atoms;
|
Atoms prop_atoms;
|
||||||
|
|
|
@ -284,7 +284,7 @@ gboolean screen_annex()
|
||||||
|
|
||||||
supported[i++] = prop_atoms.openbox_wm_state_undecorated;
|
supported[i++] = prop_atoms.openbox_wm_state_undecorated;
|
||||||
supported[i++] = prop_atoms.openbox_pid;
|
supported[i++] = prop_atoms.openbox_pid;
|
||||||
supported[i++] = prop_atoms.openbox_rc;
|
supported[i++] = prop_atoms.openbox_config;
|
||||||
supported[i++] = prop_atoms.openbox_control;
|
supported[i++] = prop_atoms.openbox_control;
|
||||||
g_assert(i == num_support);
|
g_assert(i == num_support);
|
||||||
|
|
||||||
|
|
|
@ -79,29 +79,26 @@ void parse_register(ObParseInst *i, const gchar *tag,
|
||||||
g_hash_table_insert(i->callbacks, c->tag, c);
|
g_hash_table_insert(i->callbacks, c->tag, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean parse_load_rc(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root,
|
gboolean parse_load_rc(const gchar *type, xmlDocPtr *doc, xmlNodePtr *root)
|
||||||
gchar **fileused)
|
|
||||||
{
|
{
|
||||||
GSList *it;
|
GSList *it;
|
||||||
gboolean r = FALSE;
|
gboolean r = FALSE;
|
||||||
|
gchar *fname;
|
||||||
|
|
||||||
*fileused = NULL;
|
if (type == NULL)
|
||||||
|
fname = g_strdup("rc.xml");
|
||||||
|
else
|
||||||
|
fname = g_strdup_printf("rc-%s.xml", type);
|
||||||
|
|
||||||
if (file) {
|
for (it = xdg_config_dir_paths; !r && it; it = g_slist_next(it)) {
|
||||||
if ((r = parse_load(file, "openbox_config", doc, root)))
|
gchar *path;
|
||||||
*fileused = g_strdup(file);
|
|
||||||
} else {
|
|
||||||
/* this won't run if the above code loaded a config */
|
|
||||||
for (it = xdg_config_dir_paths; !r && it; it = g_slist_next(it)) {
|
|
||||||
gchar *path;
|
|
||||||
|
|
||||||
path = g_build_filename(it->data, "openbox", "rc.xml", NULL);
|
path = g_build_filename(it->data, "openbox", fname, NULL);
|
||||||
if ((r = parse_load(path, "openbox_config", doc, root)))
|
r = parse_load(path, "openbox_config", doc, root);
|
||||||
*fileused = path;
|
g_free(path);
|
||||||
else
|
|
||||||
g_free(path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
g_free(fname);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,11 @@ typedef void (*ParseCallback)(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
|
||||||
ObParseInst* parse_startup();
|
ObParseInst* parse_startup();
|
||||||
void parse_shutdown(ObParseInst *inst);
|
void parse_shutdown(ObParseInst *inst);
|
||||||
|
|
||||||
/* Loads Openbox's rc, from the normal paths */
|
/*! Loads Openbox's rc, from the normal paths
|
||||||
gboolean parse_load_rc(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root,
|
@type The configuration type to load, or NULL to use the default.
|
||||||
gchar **fileused);
|
e.g. "gnome" would load rc-gnome.xml.
|
||||||
|
*/
|
||||||
|
gboolean parse_load_rc(const gchar *type, xmlDocPtr *doc, xmlNodePtr *root);
|
||||||
/* Loads an Openbox menu, from the normal paths */
|
/* Loads an Openbox menu, from the normal paths */
|
||||||
gboolean parse_load_menu(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root);
|
gboolean parse_load_menu(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root);
|
||||||
/* Loads an Openbox menu, from the normal paths */
|
/* Loads an Openbox menu, from the normal paths */
|
||||||
|
|
Loading…
Reference in a new issue