mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
osd: add window-switcher field content types (#1623)
...`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>
This commit is contained in:
parent
901240b321
commit
b0c2ac1a6d
5 changed files with 77 additions and 0 deletions
39
src/osd.c
39
src/osd.c
|
|
@ -239,6 +239,20 @@ get_type(struct view *view)
|
|||
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)
|
||||
{
|
||||
|
|
@ -364,6 +378,31 @@ render_osd(struct server *server, cairo_t *cairo, int w, int h,
|
|||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue