Implement assignments for (named) workspaces, with '~' compatibility (floating)
This commit is contained in:
36
src/match.c
36
src/match.c
@ -45,6 +45,25 @@ bool match_is_empty(Match *match) {
|
||||
match->floating == M_ANY);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copies the data of a match from src to dest.
|
||||
*
|
||||
*/
|
||||
void match_copy(Match *dest, Match *src) {
|
||||
memcpy(dest, src, sizeof(Match));
|
||||
|
||||
#define STRDUP(field) do { \
|
||||
if (src->field != NULL) \
|
||||
dest->field = sstrdup(src->field); \
|
||||
} while (0)
|
||||
|
||||
STRDUP(title);
|
||||
STRDUP(mark);
|
||||
STRDUP(application);
|
||||
STRDUP(class);
|
||||
STRDUP(instance);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if a match data structure matches the given window.
|
||||
*
|
||||
@ -87,20 +106,3 @@ bool match_matches_window(Match *match, i3Window *window) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the first match in 'assignments' that matches the given window.
|
||||
*
|
||||
*/
|
||||
Match *match_by_assignment(i3Window *window) {
|
||||
Match *match;
|
||||
|
||||
TAILQ_FOREACH(match, &assignments, assignments) {
|
||||
if (!match_matches_window(match, window))
|
||||
continue;
|
||||
DLOG("got a matching assignment (to %s)\n", match->target_ws);
|
||||
return match;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user