Configuration of dwm for Mac Computers
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.

81 lines
1.4 KiB

17 years ago
17 years ago
17 years ago
17 years ago
  1. /* See LICENSE file for copyright and license details. */
  2. #include "dwm.h"
  3. #include <stdio.h>
  4. /* static */
  5. static double mwfact = MWFACT;
  6. /* extern */
  7. void
  8. addtomwfact(const char *arg) {
  9. double delta;
  10. if(!isarrange(tile))
  11. return;
  12. /* arg handling, manipulate mwfact */
  13. if(arg == NULL)
  14. mwfact = MWFACT;
  15. else if(1 == sscanf(arg, "%lf", &delta)) {
  16. if(delta + mwfact > 0.1 && delta + mwfact < 0.9)
  17. mwfact += delta;
  18. }
  19. arrange();
  20. }
  21. void
  22. tile(void) {
  23. unsigned int i, n, nx, ny, nw, nh, mw, th;
  24. Client *c;
  25. for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
  26. n++;
  27. /* window geoms */
  28. mw = (n == 1) ? waw : mwfact * waw;
  29. th = (n > 1) ? wah / (n - 1) : 0;
  30. if(n > 1 && th < bh)
  31. th = wah;
  32. nx = wax;
  33. ny = way;
  34. for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) {
  35. c->ismax = False;
  36. if(i == 0) { /* master */
  37. nw = mw - 2 * c->border;
  38. nh = wah - 2 * c->border;
  39. }
  40. else { /* tile window */
  41. if(i == 1) {
  42. ny = way;
  43. nx += mw;
  44. }
  45. nw = waw - mw - 2 * c->border;
  46. if(i + 1 == n) /* remainder */
  47. nh = (way + wah) - ny - 2 * c->border;
  48. else
  49. nh = th - 2 * c->border;
  50. }
  51. resize(c, nx, ny, nw, nh, False);
  52. if(n > 1 && th != wah)
  53. ny += nh + 2 * c->border;
  54. i++;
  55. }
  56. }
  57. void
  58. zoom(const char *arg) {
  59. Client *c;
  60. if(!sel || !isarrange(tile) || sel->isfloating)
  61. return;
  62. if((c = sel) == nexttiled(clients))
  63. if(!(c = nexttiled(c->next)))
  64. return;
  65. detach(c);
  66. attach(c);
  67. focus(c);
  68. arrange();
  69. }