- *identifier* Show identifier (app_id for native Wayland
windows and WM_CLASS for XWayland clients)
+ - *trimmed_identifier* Show trimmed identifier. Trimming removes the first
+ two nodes of 'org.' strings.
+
- *title* Show window title if different to app_id
*width* defines the width of the field expressed as a percentage of
<windowSwitcher show="yes" preview="yes" outlines="yes">
<fields>
<field content="type" width="25%" />
- <field content="identifier" width="25%" />
+ <field content="trimmed_identifier" width="25%" />
+ <!-- <field content="identifier" width="25%" /> -->
<field content="title" width="50%" />
</fields>
</windowSwitcher>
LAB_FIELD_NONE = 0,
LAB_FIELD_TYPE,
LAB_FIELD_IDENTIFIER,
+ LAB_FIELD_TRIMMED_IDENTIFIER,
LAB_FIELD_TITLE,
};
} else if (!strcmp(content, "app_id")) {
wlr_log(WLR_ERROR, "window-switcher field 'app_id' is deprecated");
current_field->content = LAB_FIELD_IDENTIFIER;
+ } else if (!strcmp(content, "trimmed_identifier")) {
+ current_field->content = LAB_FIELD_TRIMMED_IDENTIFIER;
} else if (!strcmp(content, "title")) {
current_field->content = LAB_FIELD_TITLE;
} else {
int width;
} fields[] = {
{ LAB_FIELD_TYPE, 25 },
- { LAB_FIELD_IDENTIFIER, 25 },
+ { LAB_FIELD_TRIMMED_IDENTIFIER, 25 },
{ LAB_FIELD_TITLE, 50 },
{ LAB_FIELD_NONE, 0 },
};
get_formatted_app_id(struct view *view)
{
char *s = (char *)view_get_string_prop(view, "app_id");
+ if (!s) {
+ return NULL;
+ }
+ return s;
+}
+
+static const char *
+get_trimmed_app_id(char *s)
+{
if (!s) {
return NULL;
}
case LAB_FIELD_IDENTIFIER:
buf_add(&buf, get_app_id(*view));
break;
+ case LAB_FIELD_TRIMMED_IDENTIFIER:
+ {
+ char *s = (char *)get_app_id(*view);
+ buf_add(&buf, get_trimmed_app_id(s));
+ break;
+ }
case LAB_FIELD_TITLE:
buf_add(&buf, get_title(*view));
break;