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.

126 lines
2.0 KiB

  1. /* Settings */
  2. static void
  3. setgaps(int oh, int ov, int ih, int iv)
  4. {
  5. if (oh < 0) oh = 0;
  6. if (ov < 0) ov = 0;
  7. if (ih < 0) ih = 0;
  8. if (iv < 0) iv = 0;
  9. selmon->gappoh = oh;
  10. selmon->gappov = ov;
  11. selmon->gappih = ih;
  12. selmon->gappiv = iv;
  13. arrange(selmon);
  14. }
  15. static void
  16. togglegaps(const Arg *arg)
  17. {
  18. selmon->pertag->enablegaps[selmon->pertag->curtag] = !selmon->pertag->enablegaps[selmon->pertag->curtag];
  19. arrange(NULL);
  20. }
  21. static void
  22. defaultgaps(const Arg *arg)
  23. {
  24. setgaps(gappoh, gappov, gappih, gappiv);
  25. }
  26. static void
  27. incrgaps(const Arg *arg)
  28. {
  29. setgaps(
  30. selmon->gappoh + arg->i,
  31. selmon->gappov + arg->i,
  32. selmon->gappih + arg->i,
  33. selmon->gappiv + arg->i
  34. );
  35. }
  36. static void
  37. incrigaps(const Arg *arg)
  38. {
  39. setgaps(
  40. selmon->gappoh,
  41. selmon->gappov,
  42. selmon->gappih + arg->i,
  43. selmon->gappiv + arg->i
  44. );
  45. }
  46. static void
  47. incrogaps(const Arg *arg)
  48. {
  49. setgaps(
  50. selmon->gappoh + arg->i,
  51. selmon->gappov + arg->i,
  52. selmon->gappih,
  53. selmon->gappiv
  54. );
  55. }
  56. static void
  57. incrohgaps(const Arg *arg)
  58. {
  59. setgaps(
  60. selmon->gappoh + arg->i,
  61. selmon->gappov,
  62. selmon->gappih,
  63. selmon->gappiv
  64. );
  65. }
  66. static void
  67. incrovgaps(const Arg *arg)
  68. {
  69. setgaps(
  70. selmon->gappoh,
  71. selmon->gappov + arg->i,
  72. selmon->gappih,
  73. selmon->gappiv
  74. );
  75. }
  76. static void
  77. incrihgaps(const Arg *arg)
  78. {
  79. setgaps(
  80. selmon->gappoh,
  81. selmon->gappov,
  82. selmon->gappih + arg->i,
  83. selmon->gappiv
  84. );
  85. }
  86. static void
  87. incrivgaps(const Arg *arg)
  88. {
  89. setgaps(
  90. selmon->gappoh,
  91. selmon->gappov,
  92. selmon->gappih,
  93. selmon->gappiv + arg->i
  94. );
  95. }
  96. static void
  97. getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc)
  98. {
  99. unsigned int n, oe, ie;
  100. oe = ie = selmon->pertag->enablegaps[selmon->pertag->curtag];
  101. Client *c;
  102. for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
  103. if (smartgaps && n == 1) {
  104. oe = 0; // outer gaps disabled when only one client
  105. }
  106. *oh = m->gappoh*oe; // outer horizontal gap
  107. *ov = m->gappov*oe; // outer vertical gap
  108. *ih = m->gappih*ie; // inner horizontal gap
  109. *iv = m->gappiv*ie; // inner vertical gap
  110. *nc = n; // number of clients
  111. }