actions: added query tiled=any comparison for rc.xml simplification

This commit is contained in:
lynxy 2025-07-03 00:04:27 +02:00 committed by Hiroaki Yamamoto
parent 359dd8f3c7
commit 13ff64f6e4
3 changed files with 12 additions and 7 deletions

View file

@ -474,7 +474,7 @@ Actions that execute other actions. Used in keyboard/mouse bindings.
The "left" , "right", "left-occupied" and
"right-occupied" directions will not wrap.
*tiled* [up|right|down|left|center]
*tiled* [up|right|down|left|center|any]
Whether the client is tiled (snapped) along the the
indicated screen edge.

View file

@ -62,11 +62,14 @@ enum view_axis {
enum view_edge {
VIEW_EDGE_INVALID = 0,
VIEW_EDGE_LEFT,
VIEW_EDGE_RIGHT,
VIEW_EDGE_UP,
VIEW_EDGE_DOWN,
VIEW_EDGE_CENTER,
VIEW_EDGE_LEFT = (1 << 0),
VIEW_EDGE_RIGHT = (1 << 1),
VIEW_EDGE_UP = (1 << 2),
VIEW_EDGE_DOWN = (1 << 3),
VIEW_EDGE_CENTER = (1 << 4),
VIEW_EDGE_ALL = (VIEW_EDGE_LEFT | VIEW_EDGE_RIGHT |
VIEW_EDGE_UP | VIEW_EDGE_DOWN | VIEW_EDGE_CENTER),
};
enum view_wants_focus {

View file

@ -166,7 +166,7 @@ view_matches_query(struct view *view, struct view_query *query)
return false;
}
if (query->tiled != VIEW_EDGE_INVALID && query->tiled != view->tiled) {
if (query->tiled != VIEW_EDGE_INVALID && !(query->tiled & view->tiled)) {
return false;
}
@ -2116,6 +2116,8 @@ view_edge_parse(const char *direction)
return VIEW_EDGE_DOWN;
} else if (!strcasecmp(direction, "center")) {
return VIEW_EDGE_CENTER;
} else if (!strcasecmp(direction, "any")) {
return VIEW_EDGE_ALL;
} else {
return VIEW_EDGE_INVALID;
}