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.

70 lines
1.2 KiB

  1. static Client *
  2. nextc(Client *c, float f)
  3. {
  4. if (!f)
  5. return nexttiled(c);
  6. for (; c && !ISVISIBLE(c); c = c->next);
  7. return c;
  8. }
  9. static Client *
  10. prevc(Client *c, float f)
  11. {
  12. Client *p, *r;
  13. for (p = selmon->clients, r = NULL; c && p && p != c; p = p->next)
  14. if ((f || !p->isfloating) && ISVISIBLE(p))
  15. r = p;
  16. return r;
  17. }
  18. static void
  19. pushup(const Arg *arg)
  20. {
  21. Client *sel = selmon->sel;
  22. Client *c;
  23. if (!sel || (sel->isfloating && !arg->f))
  24. return;
  25. if ((c = prevc(sel, arg->f))) {
  26. /* attach before c */
  27. detach(sel);
  28. sel->next = c;
  29. if (selmon->clients == c)
  30. selmon->clients = sel;
  31. else {
  32. for (c = selmon->clients; c->next != sel->next; c = c->next);
  33. c->next = sel;
  34. }
  35. } else {
  36. /* move to the end */
  37. for (c = sel; c->next; c = c->next);
  38. detach(sel);
  39. sel->next = NULL;
  40. c->next = sel;
  41. }
  42. focus(sel);
  43. arrange(selmon);
  44. }
  45. static void
  46. pushdown(const Arg *arg)
  47. {
  48. Client *sel = selmon->sel;
  49. Client *c;
  50. if (!sel || (sel->isfloating && !arg->f))
  51. return;
  52. if ((c = nextc(sel->next, arg->f))) {
  53. /* attach after c */
  54. detach(sel);
  55. sel->next = c->next;
  56. c->next = sel;
  57. } else {
  58. /* move to the front */
  59. detach(sel);
  60. attach(sel);
  61. }
  62. focus(sel);
  63. arrange(selmon);
  64. }