Configuration file for DWM on MacBook Air
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.

100 lines
1.5 KiB

18 years ago
  1. /*
  2. * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
  3. * See LICENSE file for license details.
  4. */
  5. #include "dwm.h"
  6. void (*arrange)(Arg *) = tiling;
  7. void
  8. view(Arg *arg)
  9. {
  10. Client *c;
  11. tsel = arg->i;
  12. arrange(NULL);
  13. for(c = clients; c; c = next(c->next))
  14. draw_client(c);
  15. draw_bar();
  16. }
  17. void
  18. floating(Arg *arg)
  19. {
  20. Client *c;
  21. arrange = floating;
  22. for(c = clients; c; c = c->next) {
  23. if(c->tags[tsel])
  24. resize(c, True);
  25. else
  26. ban_client(c);
  27. }
  28. if(sel && !sel->tags[tsel]) {
  29. if((sel = next(clients))) {
  30. craise(sel);
  31. focus(sel);
  32. }
  33. }
  34. draw_bar();
  35. }
  36. void
  37. tiling(Arg *arg)
  38. {
  39. Client *c;
  40. int n, i, w, h;
  41. w = sw - mw;
  42. arrange = tiling;
  43. for(n = 0, c = clients; c; c = c->next)
  44. if(c->tags[tsel] && !c->floating)
  45. n++;
  46. if(n > 1)
  47. h = (sh - bh) / (n - 1);
  48. else
  49. h = sh - bh;
  50. for(i = 0, c = clients; c; c = c->next) {
  51. if(c->tags[tsel]) {
  52. if(c->floating) {
  53. craise(c);
  54. resize(c, True);
  55. continue;
  56. }
  57. if(n == 1) {
  58. c->x = sx;
  59. c->y = sy + bh;
  60. c->w = sw - 2 * c->border;
  61. c->h = sh - 2 * c->border - bh;
  62. }
  63. else if(i == 0) {
  64. c->x = sx;
  65. c->y = sy + bh;
  66. c->w = mw - 2 * c->border;
  67. c->h = sh - 2 * c->border - bh;
  68. }
  69. else {
  70. c->x = sx + mw;
  71. c->y = sy + (i - 1) * h + bh;
  72. c->w = w - 2 * c->border;
  73. c->h = h - 2 * c->border;
  74. }
  75. resize(c, False);
  76. i++;
  77. }
  78. else
  79. ban_client(c);
  80. }
  81. if(!sel || (sel && !sel->tags[tsel])) {
  82. if((sel = next(clients))) {
  83. craise(sel);
  84. focus(sel);
  85. }
  86. }
  87. draw_bar();
  88. }