--- dwm.c.orig 2012-07-17 16:27:24.866052205 +0200 +++ dwm.c 2012-07-17 16:33:57.585142592 +0200 @@ -227,6 +227,7 @@ static void spawn(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); +static void switchmon(const Arg *arg); static int textnw(const char *text, unsigned int len); static void tile(Monitor *); static void togglebar(const Arg *arg); @@ -1710,6 +1711,30 @@ sendmon(selmon->sel, dirtomon(arg->i)); } +void +switchmon(const Arg *arg) { + Client *current, *next; + unsigned int tag; + + if(!selmon->sel || !mons->next) + return; + + /* Sending each clients to the arg->i monitor */ + next = selmon->clients; + while(next) { + current = next; + tag = current->tags; + + next = next->next; + + sendmon(current, dirtomon(arg->i)); + + /* Sending to the same tag */ + current->tags = tag; + } +} + + int textnw(const char *text, unsigned int len) { XRectangle r;