Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
936 B

  1. void
  2. transfer(const Arg *arg)
  3. {
  4. Client *c, *mtail = selmon->clients, *stail = NULL, *insertafter;
  5. int transfertostack = 0, i, nmasterclients;
  6. for (i = 0, c = selmon->clients; c; c = c->next) {
  7. if (!ISVISIBLE(c) || c->isfloating) continue;
  8. if (selmon->sel == c) { transfertostack = i < selmon->nmaster && selmon->nmaster != 0; }
  9. if (i < selmon->nmaster) { nmasterclients++; mtail = c; }
  10. stail = c;
  11. i++;
  12. }
  13. if (!selmon->sel || selmon->sel->isfloating || i == 0) {
  14. return;
  15. } else if (transfertostack) {
  16. selmon->nmaster = MIN(i, selmon->nmaster) - 1;
  17. insertafter = stail;
  18. } else {
  19. selmon->nmaster = selmon->nmaster + 1;
  20. insertafter = mtail;
  21. }
  22. if (insertafter != selmon->sel) {
  23. detach(selmon->sel);
  24. if (selmon->nmaster == 1 && !transfertostack) {
  25. attach(selmon->sel); // Head prepend case
  26. } else {
  27. selmon->sel->next = insertafter->next;
  28. insertafter->next = selmon->sel;
  29. }
  30. }
  31. arrange(selmon);
  32. }