My patched version of suckless' dwm.
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.

58 lines
2.0 KiB

  1. diff --git a/config.def.h b/config.def.h
  2. index 7054c06..e0cdcf3 100644
  3. --- a/config.def.h
  4. +++ b/config.def.h
  5. @@ -24,9 +24,9 @@ static const Rule rules[] = {
  6. * WM_CLASS(STRING) = instance, class
  7. * WM_NAME(STRING) = title
  8. */
  9. - /* class instance title tags mask isfloating monitor */
  10. - { "Gimp", NULL, NULL, 0, 1, -1 },
  11. - { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
  12. + /* class instance title tags mask iscentered isfloating monitor */
  13. + { "Gimp", NULL, NULL, 0, 0, 1, -1 },
  14. + { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
  15. };
  16. /* layout(s) */
  17. diff --git a/dwm.c b/dwm.c
  18. index 0362114..4aaaa60 100644
  19. --- a/dwm.c
  20. +++ b/dwm.c
  21. @@ -92,7 +92,7 @@ struct Client {
  22. int basew, baseh, incw, inch, maxw, maxh, minw, minh;
  23. int bw, oldbw;
  24. unsigned int tags;
  25. - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
  26. + int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
  27. Client *next;
  28. Client *snext;
  29. Monitor *mon;
  30. @@ -137,6 +137,7 @@ typedef struct {
  31. const char *instance;
  32. const char *title;
  33. unsigned int tags;
  34. + int iscentered;
  35. int isfloating;
  36. int monitor;
  37. } Rule;
  38. @@ -296,6 +297,7 @@ applyrules(Client *c)
  39. && (!r->class || strstr(class, r->class))
  40. && (!r->instance || strstr(instance, r->instance)))
  41. {
  42. + c->iscentered = r->iscentered;
  43. c->isfloating = r->isfloating;
  44. c->tags |= r->tags;
  45. for (m = mons; m && m->num != r->monitor; m = m->next);
  46. @@ -1063,6 +1065,11 @@ manage(Window w, XWindowAttributes *wa)
  47. && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
  48. c->bw = borderpx;
  49. + if(c->iscentered) {
  50. + c->x = (c->mon->mw - WIDTH(c)) / 2;
  51. + c->y = (c->mon->mh - HEIGHT(c)) / 2;
  52. + }
  53. +
  54. wc.border_width = c->bw;
  55. XConfigureWindow(dpy, w, CWBorderWidth, &wc);
  56. XSetWindowBorder(dpy, w, scheme[SchemeNorm].border->pix);