mirror of
https://github.com/swaywm/sway.git
synced 2025-01-16 08:05:58 +01:00
criteria: Code formatting.
This commit is contained in:
parent
a06cb7cd01
commit
5483fe1883
1 changed files with 50 additions and 50 deletions
100
sway/criteria.c
100
sway/criteria.c
|
@ -247,62 +247,62 @@ static bool criteria_test(swayc_t *cont, list_t *tokens) {
|
||||||
for (int i = 0; i < tokens->length; i++) {
|
for (int i = 0; i < tokens->length; i++) {
|
||||||
struct crit_token *crit = tokens->items[i];
|
struct crit_token *crit = tokens->items[i];
|
||||||
switch (crit->type) {
|
switch (crit->type) {
|
||||||
case CRIT_CLASS:
|
case CRIT_CLASS:
|
||||||
if (!cont->class) {
|
if (!cont->class) {
|
||||||
// ignore
|
// ignore
|
||||||
} else if (strcmp(crit->raw, "focused") == 0) {
|
} else if (strcmp(crit->raw, "focused") == 0) {
|
||||||
swayc_t *focused = get_focused_view(&root_container);
|
swayc_t *focused = get_focused_view(&root_container);
|
||||||
if (focused->class && strcmp(cont->class, focused->class) == 0) {
|
if (focused->class && strcmp(cont->class, focused->class) == 0) {
|
||||||
matches++;
|
|
||||||
}
|
|
||||||
} else if (crit->regex && regexec(crit->regex, cont->class, 0, NULL, 0) == 0) {
|
|
||||||
matches++;
|
matches++;
|
||||||
}
|
}
|
||||||
break;
|
} else if (crit->regex && regexec(crit->regex, cont->class, 0, NULL, 0) == 0) {
|
||||||
case CRIT_ID:
|
matches++;
|
||||||
if (!cont->app_id) {
|
}
|
||||||
// ignore
|
break;
|
||||||
} else if (crit->regex && regexec(crit->regex, cont->app_id, 0, NULL, 0) == 0) {
|
case CRIT_ID:
|
||||||
|
if (!cont->app_id) {
|
||||||
|
// ignore
|
||||||
|
} else if (crit->regex && regexec(crit->regex, cont->app_id, 0, NULL, 0) == 0) {
|
||||||
|
matches++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CRIT_INSTANCE:
|
||||||
|
break;
|
||||||
|
case CRIT_TITLE:
|
||||||
|
if (!cont->name) {
|
||||||
|
// ignore
|
||||||
|
} else if (strcmp(crit->raw, "focused") == 0) {
|
||||||
|
swayc_t *focused = get_focused_view(&root_container);
|
||||||
|
if (focused->name && strcmp(cont->name, focused->name) == 0) {
|
||||||
matches++;
|
matches++;
|
||||||
}
|
}
|
||||||
break;
|
} else if (crit->regex && regexec(crit->regex, cont->name, 0, NULL, 0) == 0) {
|
||||||
case CRIT_INSTANCE:
|
matches++;
|
||||||
break;
|
}
|
||||||
case CRIT_TITLE:
|
break;
|
||||||
if (!cont->name) {
|
case CRIT_URGENT: // "latest" or "oldest"
|
||||||
// ignore
|
break;
|
||||||
} else if (strcmp(crit->raw, "focused") == 0) {
|
case CRIT_WINDOW_ROLE:
|
||||||
swayc_t *focused = get_focused_view(&root_container);
|
break;
|
||||||
if (focused->name && strcmp(cont->name, focused->name) == 0) {
|
case CRIT_WINDOW_TYPE:
|
||||||
matches++;
|
// TODO wlc indeed exposes this information
|
||||||
}
|
break;
|
||||||
} else if (crit->regex && regexec(crit->regex, cont->name, 0, NULL, 0) == 0) {
|
case CRIT_WORKSPACE: ;
|
||||||
|
swayc_t *cont_ws = swayc_parent_by_type(cont, C_WORKSPACE);
|
||||||
|
if (!cont_ws || !cont_ws->name) {
|
||||||
|
// ignore
|
||||||
|
} else if (strcmp(crit->raw, "focused") == 0) {
|
||||||
|
swayc_t *focused_ws = swayc_active_workspace();
|
||||||
|
if (focused_ws->name && strcmp(cont_ws->name, focused_ws->name) == 0) {
|
||||||
matches++;
|
matches++;
|
||||||
}
|
}
|
||||||
break;
|
} else if (crit->regex && regexec(crit->regex, cont_ws->name, 0, NULL, 0) == 0) {
|
||||||
case CRIT_URGENT: // "latest" or "oldest"
|
matches++;
|
||||||
break;
|
}
|
||||||
case CRIT_WINDOW_ROLE:
|
break;
|
||||||
break;
|
default:
|
||||||
case CRIT_WINDOW_TYPE:
|
sway_abort("Invalid criteria type (%i)", crit->type);
|
||||||
// TODO wlc indeed exposes this information
|
break;
|
||||||
break;
|
|
||||||
case CRIT_WORKSPACE: ;
|
|
||||||
swayc_t *cont_ws = swayc_parent_by_type(cont, C_WORKSPACE);
|
|
||||||
if (!cont_ws || !cont_ws->name) {
|
|
||||||
// ignore
|
|
||||||
} else if (strcmp(crit->raw, "focused") == 0) {
|
|
||||||
swayc_t *focused_ws = swayc_active_workspace();
|
|
||||||
if (focused_ws->name && strcmp(cont_ws->name, focused_ws->name) == 0) {
|
|
||||||
matches++;
|
|
||||||
}
|
|
||||||
} else if (crit->regex && regexec(crit->regex, cont_ws->name, 0, NULL, 0) == 0) {
|
|
||||||
matches++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
sway_abort("Invalid criteria type (%i)", crit->type);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return matches == tokens->length;
|
return matches == tokens->length;
|
||||||
|
|
Loading…
Reference in a new issue