Use class or app_id in tree representation

This commit is contained in:
Ryan Dwyer 2018-05-20 09:26:46 +10:00
parent efc07fb3d4
commit 4672cb7ccf

View File

@ -784,23 +784,32 @@ static size_t concatenate_child_titles(struct sway_container *parent,
strcpy(buffer, "F["); strcpy(buffer, "F[");
break; break;
case L_NONE: case L_NONE:
strcpy(buffer, "?["); strcpy(buffer, "D[");
break; break;
} }
} }
for (int i = 0; i < parent->children->length; ++i) { for (int i = 0; i < parent->children->length; ++i) {
if (i != 0) { if (i != 0) {
len += 2; len += 1;
if (buffer) { if (buffer) {
strcat(buffer, ", "); strcat(buffer, " ");
} }
} }
struct sway_container *child = parent->children->items[i]; struct sway_container *child = parent->children->items[i];
if (child->name) { const char *identifier = NULL;
len += strlen(child->name); if (child->type == C_VIEW) {
identifier = view_get_class(child->sway_view);
if (!identifier) {
identifier = view_get_app_id(child->sway_view);
}
} else {
identifier = child->name;
}
if (identifier) {
len += strlen(identifier);
if (buffer) { if (buffer) {
strcat(buffer, child->name); strcat(buffer, identifier);
} }
} else { } else {
len += 6; len += 6;