DLOG("Removing all existing marks on con = %p.\n", con);
mark_t *current;
- TAILQ_FOREACH(current, &(con->marks_head), marks) {
+ while (!TAILQ_EMPTY(&(con->marks_head))) {
+ current = TAILQ_FIRST(&(con->marks_head));
con_unmark(con, current->name);
}
}
CALL(parent, on_remove_child);
ipc_send_window_event("move", con);
+ ewmh_update_wm_desktop();
return true;
}
(TAILQ_FIRST(&(con->nodes_head)) == child ? "" : " "), child_txt);
free(buf);
buf = tmp_buf;
+ free(child_txt);
}
/* 3) close the brackets */
return complete_buf;
}
+
+/*
+ * Returns the container's title considering the current title format.
+ *
+ */
+i3String *con_parse_title_format(Con *con) {
+ assert(con->title_format != NULL);
+
+ i3Window *win = con->window;
+
+ /* We need to ensure that we only escape the window title if pango
+ * is used by the current font. */
+ const bool pango_markup = font_is_pango();
+
+ char *title;
+ char *class;
+ char *instance;
+ if (win == NULL) {
+ title = pango_escape_markup(con_get_tree_representation(con));
+ class = sstrdup("i3-frame");
+ instance = sstrdup("i3-frame");
+ } else {
+ title = pango_escape_markup(sstrdup((win->name == NULL) ? "" : i3string_as_utf8(win->name)));
+ class = pango_escape_markup(sstrdup((win->class_class == NULL) ? "" : win->class_class));
+ instance = pango_escape_markup(sstrdup((win->class_instance == NULL) ? "" : win->class_instance));
+ }
+
+ placeholder_t placeholders[] = {
+ {.name = "%title", .value = title},
+ {.name = "%class", .value = class},
+ {.name = "%instance", .value = instance}};
+ const size_t num = sizeof(placeholders) / sizeof(placeholder_t);
+
+ char *formatted_str = format_placeholders(con->title_format, &placeholders[0], num);
+ i3String *formatted = i3string_from_utf8(formatted_str);
+ i3string_set_markup(formatted, pango_markup);
+ FREE(formatted_str);
+
+ for (size_t i = 0; i < num; i++) {
+ FREE(placeholders[i].value);
+ }
+
+ return formatted;
+}