Implement assignments for (named) workspaces, with '~' compatibility (floating)

This commit is contained in:
Michael Stapelberg
2011-05-23 18:41:17 +02:00
parent 272a86745e
commit 2c68c234ea
10 changed files with 123 additions and 89 deletions

View File

@ -17,7 +17,7 @@ void run_assignments(i3Window *window) {
/* Check if any assignments match */
Assignment *current;
TAILQ_FOREACH(current, &real_assignments, real_assignments) {
TAILQ_FOREACH(current, &assignments, assignments) {
if (!match_matches_window(&(current->match), window))
continue;
@ -48,3 +48,21 @@ void run_assignments(i3Window *window) {
window->ran_assignments[window->nr_assignments-1] = current;
}
}
/*
* Returns the first matching assignment for the given window.
*
*/
Assignment *assignment_for(i3Window *window, int type) {
Assignment *assignment;
TAILQ_FOREACH(assignment, &assignments, assignments) {
if ((type != A_ANY && (assignment->type & type) == 0) ||
!match_matches_window(&(assignment->match), window))
continue;
DLOG("got a matching assignment (to %s)\n", assignment->dest.workspace);
return assignment;
}
return NULL;
}