struct regex *class;
struct regex *instance;
struct regex *mark;
- struct regex *role;
+ struct regex *window_role;
enum {
U_DONTCHECK = -1,
U_LATEST = 0,
}
if (strcmp(ctype, "window_role") == 0) {
- current_match->role = regex_new(cvalue);
+ current_match->window_role = regex_new(cvalue);
return;
}
}
if (strcmp(ctype, "window_role") == 0) {
- current_match->role = regex_new(cvalue);
+ current_match->window_role = regex_new(cvalue);
return;
}
} else if (strcasecmp(last_key, "instance") == 0) {
current_swallow->instance = regex_new(sval);
} else if (strcasecmp(last_key, "window_role") == 0) {
- current_swallow->role = regex_new(sval);
+ current_swallow->window_role = regex_new(sval);
} else if (strcasecmp(last_key, "title") == 0) {
current_swallow->title = regex_new(sval);
} else {
match->application == NULL &&
match->class == NULL &&
match->instance == NULL &&
- match->role == NULL &&
+ match->window_role == NULL &&
match->urgent == U_DONTCHECK &&
match->id == XCB_NONE &&
match->con_id == NULL &&
DUPLICATE_REGEX(application);
DUPLICATE_REGEX(class);
DUPLICATE_REGEX(instance);
- DUPLICATE_REGEX(role);
+ DUPLICATE_REGEX(window_role);
}
/*
}
}
- if (match->role != NULL) {
+ if (match->window_role != NULL) {
if (window->role != NULL &&
- regex_matches(match->role, window->role)) {
+ regex_matches(match->window_role, window->role)) {
LOG("window_role matches (%s)\n", window->role);
} else {
return false;
regex_free(match->class);
regex_free(match->instance);
regex_free(match->mark);
- regex_free(match->role);
+ regex_free(match->window_role);
/* Second step: free the regex helper struct itself */
FREE(match->title);
FREE(match->class);
FREE(match->instance);
FREE(match->mark);
- FREE(match->role);
+ FREE(match->window_role);
}
xcb_flush(restore_conn);
xcb_aux_sync(restore_conn);
- // TODO: actually represent the criteria, most likely just line by line from (0, 0)
set_font_colors(state->gc, config.client.focused.background, 0);
+
+ Match *swallows;
+ int n = 0;
+ TAILQ_FOREACH(swallows, &(state->con->swallow_head), matches) {
+ char *serialized = NULL;
+
+#define APPEND_REGEX(re_name) do { \
+ if (swallows->re_name != NULL) { \
+ sasprintf(&serialized, "%s%s" #re_name "=\"%s\"", \
+ (serialized ? serialized : "["), \
+ (serialized ? " " : ""), \
+ swallows->re_name->pattern); \
+ } \
+} while (0)
+
+ APPEND_REGEX(class);
+ APPEND_REGEX(instance);
+ APPEND_REGEX(window_role);
+ APPEND_REGEX(title);
+
+ if (serialized == NULL) {
+ DLOG("This swallows specification is not serializable?!\n");
+ continue;
+ }
+
+ sasprintf(&serialized, "%s]", serialized);
+ DLOG("con %p (placeholder 0x%08x) line %d: %s\n", state->con, state->window, n, serialized);
+
+ i3String *str = i3string_from_utf8(serialized);
+ draw_text(str, state->pixmap, state->gc, 2, (n * (config.font.height + 2)) + 2, state->rect.width - 2);
+ i3string_free(str);
+ n++;
+ free(serialized);
+ }
+
+ // TODO: render the watch symbol in a bigger font
i3String *line = i3string_from_utf8("⌚");
int text_width = predict_text_width(line);
int x = (state->rect.width / 2) - (text_width / 2);