query: extend "monitor" query & add missing docs

This commit is contained in:
Orfeas 2024-12-05 20:24:41 +02:00 committed by Johan Malm
parent 01032ef3bd
commit f4c270c92f
2 changed files with 19 additions and 2 deletions

View file

@ -425,6 +425,11 @@ Actions that execute other actions. Used in keyboard/mouse bindings.
Whether the client has full server-side decorations,
borders only, or no server-side decorations.
*monitor* [current|left|right|<monitor_name>]
Whether the client is on a monitor relative to the to
the currently focused monitor (current, left, or right)
or on a monitor with the supplied <monitor_name>.
This argument is optional.
*then*

View file

@ -199,8 +199,20 @@ view_matches_query(struct view *view, struct view_query *query)
}
if (query->monitor) {
struct output *target = output_from_name(view->server, query->monitor);
if (target != view->output) {
struct output *current = output_nearest_to_cursor(view->server);
if (!strcasecmp(query->monitor, "current") && current != view->output) {
return false;
}
if (!strcasecmp(query->monitor, "left") &&
output_get_adjacent(current, VIEW_EDGE_LEFT, false) != view->output) {
return false;
}
if (!strcasecmp(query->monitor, "right") &&
output_get_adjacent(current, VIEW_EDGE_RIGHT, false) != view->output) {
return false;
}
if (output_from_name(view->server, query->monitor) != view->output) {
return false;
}
}