X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=blobdiff_plain;f=src%2Fmatch.c;h=ac9ddaf98168a3b3af0eed29e73c6023b27c3067;hp=ba87eb236fb8fe737255b54391eb394f1268e801;hb=6a8fb69eff913e4ebb9a07cb2f77f59320d93805;hpb=0e73a6e9e7dcc0a01b8666f85bc279a72f7c5936 diff --git a/src/match.c b/src/match.c index ba87eb23..ac9ddaf9 100644 --- a/src/match.c +++ b/src/match.c @@ -28,6 +28,7 @@ void match_init(Match *match) { memset(match, 0, sizeof(Match)); match->urgent = U_DONTCHECK; + match->window_mode = WM_ANY; /* we use this as the placeholder value for "not set". */ match->window_type = UINT32_MAX; } @@ -53,7 +54,7 @@ bool match_is_empty(Match *match) { match->window_type == UINT32_MAX && match->con_id == NULL && match->dock == M_NODOCK && - match->floating == M_ANY); + match->window_mode == WM_ANY); } /* @@ -243,6 +244,21 @@ bool match_matches_window(Match *match, i3Window *window) { } } + if (match->window_mode != WM_ANY) { + if ((con = con_by_window_id(window->id)) == NULL) + return false; + + const bool floating = (con_inside_floating(con) != NULL); + + if ((match->window_mode == WM_TILING && floating) || + (match->window_mode == WM_FLOATING && !floating)) { + LOG("window_mode does not match\n"); + return false; + } + + LOG("window_mode matches\n"); + } + return true; } @@ -384,5 +400,15 @@ void match_parse_property(Match *match, const char *ctype, const char *cvalue) { return; } + if (strcmp(ctype, "tiling") == 0) { + match->window_mode = WM_TILING; + return; + } + + if (strcmp(ctype, "floating") == 0) { + match->window_mode = WM_FLOATING; + return; + } + ELOG("Unknown criterion: %s\n", ctype); }