aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-05-20 09:26:46 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-05-21 20:16:56 +1000
commit4672cb7ccfcba0c628e4f04cc1abcad7d769bb3d (patch)
treeec10bb7d3b518df337f846e4575f0aae06997029
parentefc07fb3d45e07529e3817b4a1598f2c3256d600 (diff)
Use class or app_id in tree representation
-rw-r--r--sway/tree/container.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 5c1f42c2..5d88325f 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -784,23 +784,32 @@ static size_t concatenate_child_titles(struct sway_container *parent,
strcpy(buffer, "F[");
break;
case L_NONE:
- strcpy(buffer, "?[");
+ strcpy(buffer, "D[");
break;
}
}
for (int i = 0; i < parent->children->length; ++i) {
if (i != 0) {
- len += 2;
+ len += 1;
if (buffer) {
- strcat(buffer, ", ");
+ strcat(buffer, " ");
}
}
struct sway_container *child = parent->children->items[i];
- if (child->name) {
- len += strlen(child->name);
+ const char *identifier = NULL;
+ 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) {
- strcat(buffer, child->name);
+ strcat(buffer, identifier);
}
} else {
len += 6;