From: Orfeas <38209077+0xfea5@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:24:41 +0000 (+0200) Subject: query: extend "monitor" query & add missing docs X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=f4c270c92f172a475411682d96ae2919a21f447a;p=proto%2Flabwc.git query: extend "monitor" query & add missing docs --- diff --git a/docs/labwc-actions.5.scd b/docs/labwc-actions.5.scd index a417d158..d0082607 100644 --- a/docs/labwc-actions.5.scd +++ b/docs/labwc-actions.5.scd @@ -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|] + 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 . + This argument is optional. *then* diff --git a/src/view.c b/src/view.c index 1d8dc7f9..df7a1116 100644 --- a/src/view.c +++ b/src/view.c @@ -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; } }