...`workspace`, `state`, `type_short` and `output`.
Example usage:
<windowSwitcher allWorkspaces="yes">
<fields>
<field content="workspace" width="5%" />
<field content="state" width="3%" />
<field content="type_short" width="3%" />
<field content="output" width="9%" />
<field content="identifier" width="30%" />
<field content="title" width="50%" />
</fields>
</windowSwitcher>
- *title* Show window title if different to app_id
+ - *workspace* Show workspace name
+
+ - *state* Show window state, M/m/F (max/min/full)
+
+ - *type_short* Show view type ("W" or "X")
+
+ - *output* Show output id, if more than one output detected
+
*width* defines the width of the field expressed as a percentage of
the overall window switcher width. The "%" character is required.
</fields>
</windowSwitcher>
+ <!--
+ When using all workspaces option of window switcher, there are extra fields
+ that can be used, workspace (variable length), state (single space),
+ type_short (3 spaces), output (variable length), and can be set up
+ like this. Note: output only shows if more than one output available.
+
+ <windowSwitcher show="yes" preview="no" outlines="no" allWorkspaces="yes">
+ <fields>
+ <field content="workspace" width="5%" />
+ <field content="state" width="3%" />
+ <field content="type_short" width="3%" />
+ <field content="output" width="9%" />
+ <field content="identifier" width="30%" />
+ <field content="title" width="50%" />
+ </fields>
+ </windowSwitcher>
+ -->
+
<!-- edge strength is in pixels -->
<resistance>
<screenEdgeStrength>20</screenEdgeStrength>
LAB_FIELD_IDENTIFIER,
LAB_FIELD_TRIMMED_IDENTIFIER,
LAB_FIELD_TITLE,
+ LAB_FIELD_WORKSPACE,
+ LAB_FIELD_WIN_STATE,
+ LAB_FIELD_TYPE_SHORT,
+ LAB_FIELD_OUTPUT,
};
enum view_placement_policy {
current_field->content = LAB_FIELD_TRIMMED_IDENTIFIER;
} else if (!strcmp(content, "title")) {
current_field->content = LAB_FIELD_TITLE;
+ } else if (!strcmp(content, "workspace")) {
+ current_field->content = LAB_FIELD_WORKSPACE;
+ } else if (!strcmp(content, "state")) {
+ current_field->content = LAB_FIELD_WIN_STATE;
+ } else if (!strcmp(content, "type_short")) {
+ current_field->content = LAB_FIELD_TYPE_SHORT;
+ } else if (!strcmp(content, "output")) {
+ current_field->content = LAB_FIELD_OUTPUT;
} else {
wlr_log(WLR_ERROR, "bad windowSwitcher field '%s'", content);
}
return "";
}
+static const char *
+get_type_short(struct view *view)
+{
+ switch (view->type) {
+ case LAB_XDG_SHELL_VIEW:
+ return "[W]";
+#if HAVE_XWAYLAND
+ case LAB_XWAYLAND_VIEW:
+ return "[X]";
+#endif
+ }
+ return "";
+}
+
static const char *
get_app_id(struct view *view)
{
case LAB_FIELD_TYPE:
buf_add(&buf, get_type(*view));
break;
+ case LAB_FIELD_TYPE_SHORT:
+ buf_add(&buf, get_type_short(*view));
+ break;
+ case LAB_FIELD_WORKSPACE:
+ buf_add(&buf, (*view)->workspace->name);
+ break;
+ case LAB_FIELD_WIN_STATE:
+ if ((*view)->maximized) {
+ buf_add(&buf, "M");
+ } else if ((*view)->minimized) {
+ buf_add(&buf, "m");
+ } else if ((*view)->fullscreen) {
+ buf_add(&buf, "F");
+ } else {
+ buf_add(&buf, " ");
+ }
+ break;
+ case LAB_FIELD_OUTPUT:
+ if (wl_list_length(&server->outputs) > 1 &&
+ output_is_usable((*view)->output)) {
+ buf_add(&buf, (*view)->output->wlr_output->name);
+ } else {
+ buf_add(&buf, " ");
+ }
+ break;
case LAB_FIELD_IDENTIFIER:
buf_add(&buf, get_app_id(*view));
break;