diff --git a/client.c b/client.c index 9f6c65d7a..28f660a69 100644 --- a/client.c +++ b/client.c @@ -275,8 +275,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen) move_client_to_screen(c, rule->screen, True); else move_client_to_screen(c, screen, True); - if(!tag_client_with_rule(c, rule)) - tag_client_with_current_selected(c); + tag_client_with_rule(c, rule); } else move_client_to_screen(c, screen, True); diff --git a/tag.c b/tag.c index f6dd53af9..2cba13a6f 100644 --- a/tag.c +++ b/tag.c @@ -93,25 +93,28 @@ tag_client_with_current_selected(Client *c) untag_client(c, tag); } -Bool +void tag_client_with_rule(Client *c, Rule *r) { Tag *tag; Bool matched = False; - if(!r) - return False; + if(!r) return; + /* check if at least one tag match */ for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next) if(tag_match_rule(tag, r)) { matched = True; - tag_client(c, tag); + break; } - else - untag_client(c, tag); - return matched; + if(matched) + for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next) + if(tag_match_rule(tag, r)) + tag_client(c, tag); + else + untag_client(c, tag); } Tag ** diff --git a/tag.h b/tag.h index 48c95e91a..6e992c835 100644 --- a/tag.h +++ b/tag.h @@ -31,7 +31,7 @@ Tag ** get_current_tags(int ); void tag_client(Client *, Tag *); void untag_client(Client *, Tag *); Bool is_client_tagged(Client *, Tag *); -Bool tag_client_with_rule(Client *, Rule *r); +void tag_client_with_rule(Client *, Rule *r); void tag_client_with_current_selected(Client *); void tag_view_only_byindex(int, int);