Window switch, add workspace info and window state (M/m/F)

This commit is contained in:
DonO 2024-03-11 17:39:03 -05:00
parent 4ecac26548
commit 7513d6abc0
4 changed files with 25 additions and 3 deletions

View file

@ -206,7 +206,7 @@ this is for compatibility with Openbox.
*content* defines what the field shows and can be any of:
- *type* Show view type ("xdg-shell" or "xwayland")
- *type* Show view type ("W" for xdg-shell or "X" for xwayland)
- *identifier* Show identifier (app_id for native Wayland
windows and WM_CLASS for XWayland clients)

View file

@ -141,6 +141,7 @@ struct rcxml {
bool show;
bool preview;
bool outlines;
bool allworkspaces;
uint32_t criteria;
struct wl_list fields; /* struct window_switcher_field.link */
} window_switcher;

View file

@ -895,9 +895,13 @@ entry(xmlNode *node, char *nodename, char *content)
} else if (!strcasecmp(nodename, "outlines.windowSwitcher")) {
set_bool(content, &rc.window_switcher.outlines);
} else if (!strcasecmp(nodename, "allWorkspaces.windowSwitcher")) {
set_bool(content, &rc.window_switcher.allworkspaces);
if (parse_bool(content, -1) == true) {
rc.window_switcher.criteria &=
~LAB_VIEW_CRITERIA_CURRENT_WORKSPACE;
} else {
rc.window_switcher.criteria |=
LAB_VIEW_CRITERIA_CURRENT_WORKSPACE;
}
/* Remove this long term - just a friendly warning for now */
@ -1155,6 +1159,7 @@ rcxml_init(void)
rc.window_switcher.show = true;
rc.window_switcher.preview = true;
rc.window_switcher.outlines = true;
rc.window_switcher.allworkspaces = false;
rc.window_switcher.criteria = LAB_VIEW_CRITERIA_CURRENT_WORKSPACE
| LAB_VIEW_CRITERIA_ROOT_TOPLEVEL
| LAB_VIEW_CRITERIA_NO_SKIP_WINDOW_SWITCHER;

View file

@ -230,10 +230,10 @@ get_type(struct view *view)
{
switch (view->type) {
case LAB_XDG_SHELL_VIEW:
return "[xdg-shell]";
return "[W] ";
#if HAVE_XWAYLAND
case LAB_XWAYLAND_VIEW:
return "[xwayland]";
return "[X] ";
#endif
}
return "";
@ -362,7 +362,23 @@ render_osd(struct server *server, cairo_t *cairo, int w, int h,
switch (field->content) {
case LAB_FIELD_TYPE:
if (rc.window_switcher.allworkspaces) {
buf_add(&buf, (*view)->workspace->name);
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, " ");
}
}
buf_add(&buf, get_type(*view));
if (rc.window_switcher.allworkspaces &&
wl_list_length(&server->outputs) > 1) {
buf_add(&buf, (*view)->output->wlr_output->name);
}
break;
case LAB_FIELD_IDENTIFIER:
buf_add(&buf, get_app_id(*view));