Add allOutputs option to window switcher

Introduces a new configuration option for the window switcher
that allows users to filter windows by output (monitor).

Changes:
- Added `allOutputs` attribute to <windowSwitcher>
  - Default is "no" (only shows windows on the cursor's output)
  - When set to "yes", shows windows from all outputs

- Introduced LAB_VIEW_CRITERIA_CURSOR_OUTPUT flag to filter views by output
  - Windows are matched against the output nearest to the cursor
  - Bit positions of existing criteria flags shifted to accommodate new flag

- Modified OSD display behavior to show only on the cursor's output
  - Previously, the OSD would appear on all outputs simultaneously
  - Now displays only on the output nearest to the cursor location

This provides better multi-monitor support by allowing users to focus on
windows relevant to their current screen, reducing visual clutter when
working across multiple displays.
This commit is contained in:
Samet Aylak 2025-11-02 08:54:29 -05:00
parent 0f62648d39
commit 764cd942eb
No known key found for this signature in database
GPG key ID: E5DEF544B937EE49
6 changed files with 43 additions and 16 deletions

View file

@ -1217,6 +1217,11 @@ entry(xmlNode *node, char *nodename, char *content)
rc.window_switcher.criteria &=
~LAB_VIEW_CRITERIA_CURRENT_WORKSPACE;
}
} else if (!strcasecmp(nodename, "allOutputs.windowSwitcher")) {
if (parse_bool(content, -1) == true) {
rc.window_switcher.criteria &=
~LAB_VIEW_CRITERIA_CURSOR_OUTPUT;
}
} else if (!strcasecmp(nodename, "unshade.windowSwitcher")) {
set_bool(content, &rc.window_switcher.unshade);
@ -1433,6 +1438,7 @@ rcxml_init(void)
rc.window_switcher.outlines = true;
rc.window_switcher.unshade = true;
rc.window_switcher.criteria = LAB_VIEW_CRITERIA_CURRENT_WORKSPACE
| LAB_VIEW_CRITERIA_CURSOR_OUTPUT
| LAB_VIEW_CRITERIA_ROOT_TOPLEVEL
| LAB_VIEW_CRITERIA_NO_SKIP_WINDOW_SWITCHER;

View file

@ -292,11 +292,20 @@ update_osd(struct server *server)
if (rc.window_switcher.show) {
/* Display the actual OSD */
struct output *output;
wl_list_for_each(output, &server->outputs, link) {
if (!output_is_usable(output)) {
continue;
}
// struct output *output;
// wl_list_for_each(output, &server->outputs, link) {
// if (!output_is_usable(output)) {
// continue;
// }
// if (!output->osd_scene.tree) {
// osd_impl->create(output, &views);
// assert(output->osd_scene.tree);
// }
// osd_impl->update(output);
// }
struct output *output = output_nearest_to_cursor(server);
if (output_is_usable(output)) {
if (!output->osd_scene.tree) {
osd_impl->create(output, &views);
assert(output->osd_scene.tree);

View file

@ -277,6 +277,13 @@ matches_criteria(struct view *view, enum lab_view_criteria criteria)
return false;
}
}
if (criteria & LAB_VIEW_CRITERIA_CURSOR_OUTPUT) {
struct server *server = view->server;
struct output *output = output_nearest_to_cursor(server);
if (view->output != output) {
return false;
}
}
if (criteria & LAB_VIEW_CRITERIA_FULLSCREEN) {
if (!view->fullscreen) {
return false;