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.

87 lines
1.6 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. setmwfact(const char *arg) {
  9. double delta, newfact;
  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(arg[0] != '+' && arg[0] != '-')
  17. newfact = delta;
  18. else
  19. newfact = mwfact + delta;
  20. if(newfact < 0.1)
  21. newfact = 0.1;
  22. else if(newfact > 0.9)
  23. newfact = 0.9;
  24. mwfact = newfact;
  25. }
  26. arrange();
  27. }
  28. void
  29. tile(void) {
  30. unsigned int i, n, nx, ny, nw, nh, mw, th;
  31. Client *c;
  32. for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
  33. n++;
  34. /* window geoms */
  35. mw = (n == 1) ? waw : mwfact * waw;
  36. th = (n > 1) ? wah / (n - 1) : 0;
  37. if(n > 1 && th < bh)
  38. th = wah;
  39. nx = wax;
  40. ny = way;
  41. for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) {
  42. c->ismax = False;
  43. if(i == 0) { /* master */
  44. nw = mw - 2 * c->border;
  45. nh = wah - 2 * c->border;
  46. }
  47. else { /* tile window */
  48. if(i == 1) {
  49. ny = way;
  50. nx += mw;
  51. }
  52. nw = waw - mw - 2 * c->border;
  53. if(i + 1 == n) /* remainder */
  54. nh = (way + wah) - ny - 2 * c->border;
  55. else
  56. nh = th - 2 * c->border;
  57. }
  58. resize(c, nx, ny, nw, nh, False);
  59. if(n > 1 && th != wah)
  60. ny += nh + 2 * c->border;
  61. i++;
  62. }
  63. }
  64. void
  65. zoom(const char *arg) {
  66. Client *c;
  67. if(!sel || !isarrange(tile) || sel->isfloating)
  68. return;
  69. if((c = sel) == nexttiled(clients))
  70. if(!(c = nexttiled(c->next)))
  71. return;
  72. detach(c);
  73. attach(c);
  74. focus(c);
  75. arrange();
  76. }