Codebase list i3-gaps / 59108ec
Merge pull request #3816 from sandsmark/martin/empty-matches Match empty window properties (e. g. no title set) #3308 Orestis Floros authored 4 years ago GitHub committed 4 years ago
2 changed file(s) with 18 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
9191 #define CHECK_WINDOW_FIELD(match_field, window_field, type) \
9292 do { \
9393 if (match->match_field != NULL) { \
94 if (window->window_field == NULL) { \
95 return false; \
96 } \
97 \
98 const char *window_field_str = GET_FIELD_##type(window->window_field); \
94 const char *window_field_str = window->window_field == NULL \
95 ? "" \
96 : GET_FIELD_##type(window->window_field); \
9997 if (strcmp(match->match_field->pattern, "__focused__") == 0 && \
10098 focused && focused->window && focused->window->window_field && \
10199 strcmp(window_field_str, GET_FIELD_##type(focused->window->window_field)) == 0) { \
3232 # not match it
3333 ######################################################################
3434 # TODO: specify more match types
35 # we can match on any (non-empty) class here since that window does not have
36 # WM_CLASS set
37 cmd q|[class=".*"] kill|;
35 # Try matching with an empty pattern since there isn't a WM_CLASS set.
3836 cmd q|[con_id="99999"] kill|;
3937
4038 is_num_children($tmp, 1, 'window still there');
102100 wait_for_unmap $left;
103101 is_num_children($tmp, 0, 'window killed');
104102
103 ######################################################################
104 # check that we can match empty properties
105 ######################################################################
106
107 $tmp = fresh_workspace;
108
109 $left = open_window(name => 'class is empty', wm_class => '');
110 ok($left->mapped, 'left window mapped');
111 is_num_children($tmp, 1, 'window opened');
112
113 cmd '[class="^$"] kill';
114 wait_for_unmap $left;
115 is_num_children($tmp, 0, 'window killed');
116
105117 done_testing;