diff --git a/catwm.c b/catwm.c index 1c29b16..2762789 100755 --- a/catwm.c +++ b/catwm.c @@ -189,20 +189,21 @@ void change_desktop(const Arg arg) { } void client_to_desktop(const Arg arg) { - client *tmp = current; - int tmp2 = current_desktop; - if(arg.i == current_desktop || current == NULL) return; - // Add client to desktop + Window w = current->win; + int tmp2 = current_desktop; + + remove_window(w); + XUnmapWindow(dis, w); // Fix visual window persistance glitch + save_desktop(tmp2); // Fix syncing issue to prevent segfault + select_desktop(arg.i); - add_window(tmp->win); + add_window(w); save_desktop(arg.i); - // Remove client from current desktop select_desktop(tmp2); - remove_window(current->win); tile(); update_current();