Window switcher, more changes

This commit is contained in:
DonO 2024-03-12 16:25:25 -05:00
parent 12a9aba0fd
commit 7e8c8b6a5a
4 changed files with 31 additions and 20 deletions

View file

@ -64,7 +64,7 @@
</windowSwitcher> </windowSwitcher>
<!-- <!--
When using all workspaces optiion of window switcher, there is a replacement When using all workspaces option of window switcher, there is a replacement
for "type" above called "winfo" that will give more info about the window, for "type" above called "winfo" that will give more info about the window,
workspace name, state of window (min, max, full) and output that it's on workspace name, state of window (min, max, full) and output that it's on
if more than one monitor is being used. if more than one monitor is being used.

View file

@ -21,7 +21,10 @@ enum window_switcher_field_content {
LAB_FIELD_IDENTIFIER, LAB_FIELD_IDENTIFIER,
LAB_FIELD_TRIMMED_IDENTIFIER, LAB_FIELD_TRIMMED_IDENTIFIER,
LAB_FIELD_TITLE, LAB_FIELD_TITLE,
LAB_FIELD_WINFO, LAB_FIELD_WORKSPACE,
LAB_FIELD_WIN_STATE,
LAB_FIELD_TYPE_SHORT,
LAB_FIELD_OUTPUT,
}; };
enum view_placement_policy { enum view_placement_policy {
@ -142,7 +145,6 @@ struct rcxml {
bool show; bool show;
bool preview; bool preview;
bool outlines; bool outlines;
bool all_workspaces;
uint32_t criteria; uint32_t criteria;
struct wl_list fields; /* struct window_switcher_field.link */ struct wl_list fields; /* struct window_switcher_field.link */
} window_switcher; } window_switcher;

View file

@ -206,8 +206,14 @@ fill_window_switcher_field(char *nodename, char *content)
current_field->content = LAB_FIELD_TRIMMED_IDENTIFIER; current_field->content = LAB_FIELD_TRIMMED_IDENTIFIER;
} else if (!strcmp(content, "title")) { } else if (!strcmp(content, "title")) {
current_field->content = LAB_FIELD_TITLE; current_field->content = LAB_FIELD_TITLE;
} else if (!strcmp(content, "winfo")) { } else if (!strcmp(content, "workspace")) {
current_field->content = LAB_FIELD_WINFO; 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 { } else {
wlr_log(WLR_ERROR, "bad windowSwitcher field '%s'", content); wlr_log(WLR_ERROR, "bad windowSwitcher field '%s'", content);
} }
@ -897,8 +903,7 @@ entry(xmlNode *node, char *nodename, char *content)
} else if (!strcasecmp(nodename, "outlines.windowSwitcher")) { } else if (!strcasecmp(nodename, "outlines.windowSwitcher")) {
set_bool(content, &rc.window_switcher.outlines); set_bool(content, &rc.window_switcher.outlines);
} else if (!strcasecmp(nodename, "allWorkspaces.windowSwitcher")) { } else if (!strcasecmp(nodename, "allWorkspaces.windowSwitcher")) {
set_bool(content, &rc.window_switcher.all_workspaces); if (parse_bool(content, -1) == true) {
if (rc.window_switcher.all_workspaces) {
rc.window_switcher.criteria &= rc.window_switcher.criteria &=
~LAB_VIEW_CRITERIA_CURRENT_WORKSPACE; ~LAB_VIEW_CRITERIA_CURRENT_WORKSPACE;
} }

View file

@ -378,20 +378,24 @@ render_osd(struct server *server, cairo_t *cairo, int w, int h,
case LAB_FIELD_TYPE: case LAB_FIELD_TYPE:
buf_add(&buf, get_type(*view)); buf_add(&buf, get_type(*view));
break; break;
case LAB_FIELD_WINFO: case LAB_FIELD_TYPE_SHORT:
if (rc.window_switcher.all_workspaces) {
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_winfo(*view)); buf_add(&buf, get_winfo(*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 && if (wl_list_length(&server->outputs) > 1 &&
output_is_usable((*view)->output)) { output_is_usable((*view)->output)) {
buf_add(&buf, (*view)->output->wlr_output->name); buf_add(&buf, (*view)->output->wlr_output->name);