#include "mouse.h"
#include "actions.h"
#include "translate.h"
+#include "hooks.h"
#include "client.h"
#include "screen.h"
#include "openbox.h"
gchar *config_theme;
gboolean config_theme_keepborder;
+guint config_theme_window_list_icon_size;
gchar *config_title_layout;
ObAppSettings* config_create_app_settings(void)
{
ObAppSettings *settings = g_new0(ObAppSettings, 1);
+ settings->type = -1;
settings->decor = -1;
settings->shade = -1;
settings->monitor = -1;
g_assert(src != NULL);
g_assert(dst != NULL);
+ copy_if(type, (ObClientType)-1);
copy_if(decor, -1);
copy_if(shade, -1);
copy_if(focus, -1);
static void parse_per_app_settings(xmlNodePtr node, gpointer d)
{
xmlNodePtr app = obt_parse_find_node(node->children, "application");
- gchar *name = NULL, *class = NULL, *role = NULL;
- gboolean name_set, class_set;
+ gchar *name = NULL, *class = NULL, *role = NULL, *type = NULL;
+ gboolean name_set, class_set, type_set;
gboolean x_pos_given;
while (app) {
- name_set = class_set = x_pos_given = FALSE;
+ name_set = class_set = type_set = x_pos_given = FALSE;
class_set = obt_parse_attr_string(app, "class", &class);
name_set = obt_parse_attr_string(app, "name", &name);
+ type_set = obt_parse_attr_string(app, "type", &type);
if (class_set || name_set) {
xmlNodePtr n, c;
ObAppSettings *settings = config_create_app_settings();;
if (class_set)
settings->class = g_pattern_spec_new(class);
+ if (type_set) {
+ if (!g_ascii_strcasecmp(type, "normal"))
+ settings->type = OB_CLIENT_TYPE_NORMAL;
+ else if (!g_ascii_strcasecmp(type, "dialog"))
+ settings->type = OB_CLIENT_TYPE_DIALOG;
+ else if (!g_ascii_strcasecmp(type, "splash"))
+ settings->type = OB_CLIENT_TYPE_SPLASH;
+ else if (!g_ascii_strcasecmp(type, "utility"))
+ settings->type = OB_CLIENT_TYPE_UTILITY;
+ else if (!g_ascii_strcasecmp(type, "menu"))
+ settings->type = OB_CLIENT_TYPE_MENU;
+ else if (!g_ascii_strcasecmp(type, "toolbar"))
+ settings->type = OB_CLIENT_TYPE_TOOLBAR;
+ else if (!g_ascii_strcasecmp(type, "dock"))
+ settings->type = OB_CLIENT_TYPE_DOCK;
+ else if (!g_ascii_strcasecmp(type, "desktop"))
+ settings->type = OB_CLIENT_TYPE_DESKTOP;
+ }
+
if (obt_parse_attr_string(app, "role", &role))
settings->role = g_pattern_spec_new(role);
}
}
+static void parse_hook(xmlNodePtr node, gpointer d)
+{
+ gchar *name;
+ ObHook hook;
+ xmlNodePtr n;
+
+
+ if (!obt_parse_attr_string(node, "name", &name)) {
+ g_message(_("Hook in config file is missing a name"));
+ return;
+ }
+
+ hook = hooks_hook_from_name(name);
+ if (!hook)
+ g_message(_("Unknown hook \"%s\" in config file"), name);
+ else {
+ if ((n = obt_parse_find_node(node->children, "action")))
+ while (n) {
+ ObActionsAct *action;
+
+ action = actions_parse(n);
+ if (action)
+ hooks_add(hook, action);
+ n = obt_parse_find_node(n->next, "action");
+ }
+ }
+
+ g_free(name);
+}
+
+static void parse_hooks(xmlNodePtr node, gpointer d)
+{
+ xmlNodePtr n;
+
+ if ((n = obt_parse_find_node(node->children, "hook")))
+ while (n) {
+ parse_hook(n, NULL);
+ n = obt_parse_find_node(n->next, "hook");
+ }
+}
+
/*
<keybind key="C-x">
config_theme_keepborder = obt_parse_node_bool(n);
if ((n = obt_parse_find_node(node, "animateIconify")))
config_animate_iconify = obt_parse_node_bool(n);
+ if ((n = obt_parse_find_node(node, "windowListIconSize"))) {
+ config_theme_window_list_icon_size = obt_parse_node_int(n);
+ if (config_theme_window_list_icon_size < 16)
+ config_theme_window_list_icon_size = 16;
+ else if (config_theme_window_list_icon_size > 96)
+ config_theme_window_list_icon_size = 96;
+ }
n = obt_parse_find_node(node, "font");
while (n) {
if ((n2 = obt_parse_find_node(n->children, "y")))
config_parse_gravity_coord(n2,
&config_resize_popup_fixed.y);
+
+ config_resize_popup_fixed.x.pos =
+ MAX(config_resize_popup_fixed.x.pos, 0);
+ config_resize_popup_fixed.y.pos =
+ MAX(config_resize_popup_fixed.y.pos, 0);
}
}
}
config_dock_app_move_button = b;
config_dock_app_move_modifiers = s;
} else {
- g_message(_("Invalid button '%s' specified in config file"), str);
+ g_message(_("Invalid button \"%s\" specified in config file"), str);
}
g_free(str);
}
static void parse_menu(xmlNodePtr node, gpointer d)
{
xmlNodePtr n;
- for (node = node->children; node; node = node->next) {
- if (!xmlStrcasecmp(node->name, (const xmlChar*) "file")) {
- gchar *c;
+ node = node->children;
- c = obt_parse_node_string(node);
+ if ((n = obt_parse_find_node(node, "hideDelay")))
+ config_menu_hide_delay = obt_parse_node_int(n);
+ if ((n = obt_parse_find_node(node, "middle")))
+ config_menu_middle = obt_parse_node_bool(n);
+ if ((n = obt_parse_find_node(node, "submenuShowDelay")))
+ config_submenu_show_delay = obt_parse_node_int(n);
+ if ((n = obt_parse_find_node(node, "applicationIcons")))
+ config_menu_client_list_icons = obt_parse_node_bool(n);
+ if ((n = obt_parse_find_node(node, "manageDesktops")))
+ config_menu_manage_desktops = obt_parse_node_bool(n);
+
+ while ((node = obt_parse_find_node(node, "file"))) {
+ gchar *c = obt_parse_node_string(node);
config_menu_files = g_slist_append(config_menu_files,
obt_paths_expand_tilde(c));
g_free(c);
- }
- if ((n = obt_parse_find_node(node, "hideDelay")))
- config_menu_hide_delay = obt_parse_node_int(n);
- if ((n = obt_parse_find_node(node, "middle")))
- config_menu_middle = obt_parse_node_bool(n);
- if ((n = obt_parse_find_node(node, "submenuShowDelay")))
- config_submenu_show_delay = obt_parse_node_int(n);
- if ((n = obt_parse_find_node(node, "applicationIcons")))
- config_menu_client_list_icons = obt_parse_node_bool(n);
- if ((n = obt_parse_find_node(node, "manageDesktops")))
- config_menu_manage_desktops = obt_parse_node_bool(n);
+ node = node->next;
}
}
config_animate_iconify = TRUE;
config_title_layout = g_strdup("NLIMC");
config_theme_keepborder = TRUE;
+ config_theme_window_list_icon_size = 36;
config_font_activewindow = NULL;
config_font_inactivewindow = NULL;
obt_parse_register(i, "menu", parse_menu, NULL);
+ obt_parse_register(i, "hooks", parse_hooks, NULL);
+
config_per_app_settings = NULL;
obt_parse_register(i, "applications", parse_per_app_settings, NULL);