Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 53 lines (50 sloc) 1.639 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
--- dwm.c.orig 2012-04-03 07:46:37.601960478 +0200
+++ dwm.c 2012-04-03 07:47:24.718558096 +0200
@@ -91,7 +91,7 @@ struct Client {
  int basew, baseh, incw, inch, maxw, maxh, minw, minh;
  int bw, oldbw;
  unsigned int tags;
- Bool isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
+ Bool isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, needresize, iscentred;
  Client *next;
  Client *snext;
  Monitor *mon;
@@ -162,6 +162,7 @@ typedef struct {
  const char *title;
  unsigned int tags;
  Bool isfloating;
+ Bool iscentred;
  int monitor;
 } Rule;
 
@@ -318,6 +319,7 @@ applyrules(Client *c) {
 
  /* rule matching */
  c->isfloating = c->tags = 0;
+ c->iscentred = 1;
  XGetClassHint(dpy, c->win, &ch);
  class = ch.res_class ? ch.res_class : broken;
  instance = ch.res_name ? ch.res_name : broken;
@@ -329,6 +331,7 @@ applyrules(Client *c) {
  && (!r->instance || strstr(instance, r->instance)))
  {
  c->isfloating = r->isfloating;
+ c->iscentred = r->iscentred;
  c->tags |= r->tags;
  for(m = mons; m && m->num != r->monitor; m = m->next);
  if(m)
@@ -1211,8 +1214,14 @@ manage(Window w, XWindowAttributes *wa)
  applyrules(c);
  }
  /* geometry */
- c->x = c->oldx = wa->x;
- c->y = c->oldy = wa->y;
+ if((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && c->iscentred) {
+ c->x = c->oldx = c->mon->wx + (c->mon->ww / 2 - wa->width / 2);
+ c->y = c->oldy = c->mon->wy + (c->mon->wh / 2 - wa->height / 2);
+ }
+ else {
+ c->x = c->oldx = wa->x;
+ c->y = c->oldy = wa->y;
+ }
  c->w = c->oldw = wa->width;
  c->h = c->oldh = wa->height;
  c->oldbw = wa->border_width;
Something went wrong with that request. Please try again.