if (!strcmp(app->name, client->name)) {
ob_debug("Window matching: %s\n", app->name);
- if (!app->role || !strcmp(app->role, client->role))
+ /* Match if no role was specified in the per app setting, or if the string
+ * matches the beginning of the role, since apps like to set the role to
+ * things like browser-window-23c4b2f */
+ if (!app->role || !strncmp(app->role, client->role, strlen(app->role)))
return app;
}
settings = get_settings(self);
if (settings) {
- if (settings->shade && !settings->decor)
- settings->decor = TRUE;
-
- client_shade(self, settings->shade);
- client_set_undecorated(self, !settings->decor);
-
- if (settings->desktop != -1)
+ /* Don't worry, we won't actually both shade and undecorate the
+ * window when push comes to shove. */
+ if (settings->shade != -1)
+ client_shade(self, settings->shade);
+ if (settings->decor != -1)
+ client_set_undecorated(self, !settings->decor);
+ if (settings->iconic != -1)
+ client_iconify(self, settings->iconic);
+ if (settings->skip_pager != -1)
+ client->skip_pager = !!settings->skip_pager;
+ if (settings->skip_taskbar != -1)
+ client->skip_taskbar = !!settings->skip_taskbar;
+
+ /* 1 && -1 shouldn't be possible by the code in config.c */
+ if (settings->max_vert == 1 && self->max_horz == 1)
+ client_maximize(self, TRUE, 0, TRUE);
+ else if (settings->max_vert == 0 && self->max_horz == 0)
+ client_maximize(self, FALSE, 0, TRUE);
+ else if (settings->max_vert == 1 && self->max_horz == 0) {
+ client_maximize(self, TRUE, 2, TRUE);
+ client_maximize(self, FALSE, 1, TRUE);
+ } else if (settings->max_vert == 0 && self->max_horz == 1) {
+ client_maximize(self, TRUE, 1, TRUE);
+ client_maximize(self, FALSE, 2, TRUE);
+ }
+
+ if (settings->fullscreen != -1)
+ client_fullscreen(self, !!settings->fullscreen, TRUE);
+
+ if (settings->desktop < screen_num_desktops)
client_set_desktop(self, settings->desktop, FALSE);
- client_set_layer(self, settings->layer);
+ if (settings->layer > -2 && settings->layer < 2)
+ client_set_layer(self, settings->layer);
+
}
stacking_add(CLIENT_AS_WINDOW(self));
/* focus the new window? */
if (ob_state() != OB_STATE_STARTING &&
(config_focus_new || client_search_focus_parent(self)) ||
- (settings && settings->focus) &&
+ (settings && settings->focus == TRUE) &&
/* note the check against Type_Normal/Dialog, not client_normal(self),
which would also include other types. in this case we want more
strict rules for focus */
Some notes: head is the screen number in a multi monitor
(Xinerama) setup (starting from 0) or mouse, meaning the
head the pointer is on. Default: mouse.
- If decor is false and shade is true, the decor will be
- set to true (otherwise we will have an invisible window).
Layer can be three values, above (Always on top), below
(Always on bottom) and everything else (normal behaviour).
Positions can be an integer value or center, which will
if (!parse_attr_string("role", app, &settings->role))
settings->role = NULL;
- settings->decor = TRUE;
+ settings->decor = -1;
if ((n = parse_find_node("decor", app->children)))
settings->decor = parse_bool(doc, n);
+ settings->shade = -1;
if ((n = parse_find_node("shade", app->children)))
settings->shade = parse_bool(doc, n);
settings->pos_given = FALSE;
if ((n = parse_find_node("position", app->children))) {
if ((c = parse_find_node("x", n->children))) {
- if (!strcmp(parse_string(doc, c), "center")) {
+ str *s = parse_string(doc, c);
+ if (!strcmp(s, "center")) {
settings->center_x = TRUE;
x_pos_given = TRUE;
} else {
settings->position.x = parse_int(doc, c);
x_pos_given = TRUE;
}
+ g_free(s);
}
if (x_pos_given && (c = parse_find_node("y", n->children))) {
- if (!strcmp(parse_string(doc, c), "center")) {
+ str *s = parse_string(doc, c);
+ if (!strcmp(s, "center")) {
settings->center_y = TRUE;
settings->pos_given = TRUE;
} else {
settings->position.y = parse_int(doc, c);
settings->pos_given = TRUE;
}
+ g_free(s);
}
}
+ settings->focus = -1;
if ((n = parse_find_node("focus", app->children)))
settings->focus = parse_bool(doc, n);
- if ((n = parse_find_node("desktop", app->children)))
- settings->desktop = parse_int(doc, n);
- else
- settings->desktop = -1;
+ if ((n = parse_find_node("desktop", app->children))) {
+ str *s = parse_string(doc, n);
+ if (!strcmp(s, "all"))
+ settings->desktop = DESKTOP_ALL;
+ else
+ settings->desktop = parse_int(doc, n);
+ g_free(s);
+ } else
+ settings->desktop = DESKTOP_ALL - 1; /* lets hope the user
+ * doesn't have 2^32
+ * desktops */
if ((n = parse_find_node("head", app->children))) {
- if (!strcmp(parse_string(doc, n), "mouse"))
+ str *s = parse_string(doc, n);
+ if (!strcmp(s, "mouse"))
settings->head = -1;
else
settings->head = parse_int(doc, n);
+ g_free(s);
}
+ settings->layer = -2;
if ((n = parse_find_node("layer", app->children))) {
- if (!strcmp(parse_string(doc, n), "above"))
+ str *s = parse_string(doc, n);
+ if (!strcmp(s, "above"))
settings->layer = 1;
- else if (!strcmp(parse_string(doc, n), "below"))
+ else if (!strcmp(s, "below"))
settings->layer = -1;
else
settings->layer = 0;
+ g_free(s);
+ }
+
+ settings->iconic = -1;
+ if ((n = parse_find_node("iconic", app->children)))
+ settings->iconic = parse_bool(doc, n);
+
+ settings->skip_pager = -1;
+ if ((n = parse_find_node("skip_pager", app->children)))
+ settings->skip_pager = parse_bool(doc, n);
+
+ settings->skip_taskbar = -1;
+ if ((n = parse_find_node("skip_taskbar", app->children)))
+ settings->skip_taskbar = parse_bool(doc, n);
+
+ settings->fullscreen = -1;
+ if ((n = parse_find_node("fullscreen", app->children)))
+ settings->fullscreen = parse_bool(doc, n);
+
+ settings->max_horz = -1;
+ settings->max_vert = -1;
+ if ((n = parse_find_node("maximized", app->children))) {
+ str *s = parse_string(doc, n);
+ if (!strcmp(s, "horizontal")) {
+ settings->max_horz = TRUE;
+ settings->max_vert = FALSE;
+ } else if (!strcmp(s, "vertical")) {
+ settings->max_horz = FALSE;
+ settings->max_vert = TRUE;
+ } else
+ settings->max_horz = settings->max_vert =
+ parse_bool(doc, n);
+ g_free(s);
}
config_per_app_settings = g_slist_append(config_per_app_settings,