diff --git a/client.c b/client.c index f23e657c..5fbc8be5 100644 --- a/client.c +++ b/client.c @@ -271,6 +271,27 @@ configure(Client * c) XSendEvent(c->display, c->win, False, StructureNotifyMask, (XEvent *) & ce); } +/** Attach client after another one +* \param client to attach to +* \param c the client +*/ +void +client_reattach_after(Client *head, Client *c) +{ + if(head->next == c) + return; + + if(head->next) + head->next->prev = c; + + if(c->prev) + c->prev->next = c->next; + + c->next = head->next; + head->next = c; + c->prev = head; +} + /** Attach client to the beginning of the clients stack * \param head client list * \param c the client diff --git a/client.h b/client.h index 6efe6c15..9eebbdeb 100644 --- a/client.h +++ b/client.h @@ -31,6 +31,7 @@ Client * get_client_bywin(Client **, Window); void grabbuttons(Client *, Bool, Bool, KeySym, unsigned int); inline void client_attach(Client **, Client *); inline void client_detach(Client **, Client *); +void client_reattach_after(Client *, Client *); void ban(Client *); /* bans c */ void configure(Client *); /* send synthetic configure event */ void focus(Client *, Bool, awesome_config *); diff --git a/tab.c b/tab.c index 11d52bf3..f2cb55f4 100644 --- a/tab.c +++ b/tab.c @@ -89,6 +89,7 @@ uicb_tab(awesome_config *awesomeconf, c->tab.prev = tmp; c->tab.isvisible = False; + client_reattach_after(sel, c); arrange(awesomeconf); focus(sel, True, awesomeconf); }