Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. --- dwm.c.orig 2012-03-15 20:02:26.714393218 +0100
  2. +++ src/dwm-6.0/dwm.c 2012-03-15 20:02:12.317726810 +0100
  3. @@ -175,6 +175,7 @@
  4. static void attach(Client *c);
  5. static void attachstack(Client *c);
  6. static void buttonpress(XEvent *e);
  7. +static void chat(Monitor *m);
  8. static void checkotherwm(void);
  9. static void cleanup(void);
  10. static void cleanupmon(Monitor *mon);
  11. @@ -2271,6 +2272,56 @@
  12. }
  13. }
  14.  
  15. +void
  16. +chat(Monitor *m) {
  17. + unsigned int n, cols, rows, cn, rn, i, cx, cy, cw, ch, ww;
  18. + Client *c, *bl = NULL;
  19. +
  20. + for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++)
  21. + if(strstr(c->name, "emesene"))
  22. + bl = c;
  23. + if(n == 0)
  24. + return;
  25. +
  26. + /* buddy list */
  27. + ww = (bl ? m->mfacts[m->curtag] * m->ww : m->ww);
  28. + if(bl) {
  29. + resize(bl, m->wx + ww, m->wy, m->ww - ww - 2 * bl->bw, m->wh - 2 * bl->bw, False);
  30. + if(--n == 0)
  31. + return;
  32. + }
  33. +
  34. + /* grid dimensions */
  35. + for(cols = 0; cols <= n/2; cols++)
  36. + if(cols*cols >= n)
  37. + break;
  38. + if(n == 5) /* set layout against the general calculation: not 1:2:2, but 2:3 */
  39. + cols = 2;
  40. + rows = n/cols;
  41. +
  42. + /* window geometries */
  43. + cw = cols ? ww / cols : ww;
  44. + cn = 0; /* current column number */
  45. + rn = 0; /* current row number */
  46. + for(i = 0, c = nexttiled(m->clients); c; i++, c = nexttiled(c->next)) {
  47. + if(c == bl) {
  48. + --i;
  49. + continue;
  50. + }
  51. + if(i/rows + 1 > cols - n%cols)
  52. + rows = n/cols + 1;
  53. + ch = rows ? m->wh / rows : m->wh;
  54. + cx = m->wx + cn*cw;
  55. + cy = m->wy + rn*ch;
  56. + resize(c, cx, cy, cw - 2 * c->bw, ch - 2 * c->bw, False);
  57. + rn++;
  58. + if(rn >= rows) {
  59. + rn = 0;
  60. + cn++;
  61. + }
  62. + }
  63. +}
  64. +
  65. int
  66. main(int argc, char *argv[]) {
  67. if(argc == 2 && !strcmp("-v", argv[1]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement