This commit is contained in:
bonsaiiV 2025-02-14 08:25:19 +00:00 committed by GitHub
commit fff2c90805
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 22 deletions

View file

@ -165,6 +165,31 @@ static bool has_container_criteria(struct criteria *criteria) {
static bool criteria_matches_container(struct criteria *criteria,
struct sway_container *container) {
struct sway_seat *seat = input_manager_current_seat();
struct sway_container *focus = seat_get_focused_container(seat);
struct sway_view *focused = focus ? focus->view : NULL;
if (criteria->workspace) {
struct sway_workspace *ws = container->pending.workspace;
if (!ws) {
return false;
}
switch (criteria->workspace->match_type) {
case PATTERN_FOCUSED:
if (focused &&
strcmp(ws->name, focused->container->pending.workspace->name)) {
return false;
}
break;
case PATTERN_PCRE2:
if (regex_cmp(ws->name, criteria->workspace->regex) < 0) {
return false;
}
break;
}
}
if (criteria->con_mark) {
bool exists = false;
struct sway_container *con = container;
@ -424,27 +449,6 @@ static bool criteria_matches_view(struct criteria *criteria,
}
}
if (criteria->workspace) {
struct sway_workspace *ws = view->container->pending.workspace;
if (!ws) {
return false;
}
switch (criteria->workspace->match_type) {
case PATTERN_FOCUSED:
if (focused &&
strcmp(ws->name, focused->container->pending.workspace->name)) {
return false;
}
break;
case PATTERN_PCRE2:
if (regex_cmp(ws->name, criteria->workspace->regex) < 0) {
return false;
}
break;
}
}
if (criteria->pid) {
if (criteria->pid != view->pid) {
return false;

View file

@ -1071,7 +1071,7 @@ The following attributes may be matched with:
applications and requires XWayland.
*workspace*
Compare against the workspace name for this view. Can be a regular
Compare against the workspace name for this container. Can be a regular
expression. If the value is \_\_focused\_\_, then all the views on the
currently focused workspace matches.