diff --git a/README b/README deleted file mode 100644 index 95d4fd0..0000000 --- a/README +++ /dev/null @@ -1,48 +0,0 @@ -dwm - dynamic window manager -============================ -dwm is an extremely fast, small, and dynamic window manager for X. - - -Requirements ------------- -In order to build dwm you need the Xlib header files. - - -Installation ------------- -Edit config.mk to match your local setup (dwm is installed into -the /usr/local namespace by default). - -Afterwards enter the following command to build and install dwm (if -necessary as root): - - make clean install - - -Running dwm ------------ -Add the following line to your .xinitrc to start dwm using startx: - - exec dwm - -In order to connect dwm to a specific display, make sure that -the DISPLAY environment variable is set correctly, e.g.: - - DISPLAY=foo.bar:1 exec dwm - -(This will start dwm on display :1 of the host foo.bar.) - -In order to display status info in the bar, you can do something -like this in your .xinitrc: - - while xsetroot -name "`date` `uptime | sed 's/.*,//'`" - do - sleep 1 - done & - exec dwm - - -Configuration -------------- -The configuration of dwm is done by creating a custom config.h -and (re)compiling the source code. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b2ee61f --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# My fork of DWM +============================ +dwm is an extremely fast, small, and dynamic window manager for X. + + +## Requirements +------------ +In order to build dwm you need the Xlib header files. + + +## Installation +------------ +Edit config.mk to match your local setup (dwm is installed into +the /usr/local namespace by default). + +Afterwards enter the following command to build and install dwm (if +necessary as root): + + make clean install + + or + + sudo make clean install + + +Running dwm +----------- +Add the following line to your .xinitrc to start dwm using startx: + + exec dwm + + or + + + while :; do + dwm || break + done + +Using the second method on this build means that you can reload DWM if you have recompiled it. To kill dwm in my fork press **$MOD+x** + +## My configuration +------------- +My configuration has three patches applied these are: +1. Rotate stack +2. Pertag +3. Centered +The diff files for the patches that I applied are in this repo under the patches directory. + +More information on patching can be found on the suckless website. +dwm.sucless.org/patches/ diff --git a/config.h b/config.h index 7c1a0b9..040b307 100644 --- a/config.h +++ b/config.h @@ -19,12 +19,12 @@ static const Rule rules[] = { * WM_CLASS(STRING) = instance, class * WM_NAME(STRING) = title */ - /* class instance title tags mask isfloating monitor */ - { "stalonetray", NULL, NULL, 1 << 8, 1, -1 }, - { "st-256color", NULL, "pulsemixer", 0, 1, -1 }, - { "st-256color", NULL, "ncmpcpp", 0, 1, -1 }, - { "st-256color", NULL, "tmux", 0, 1, -1 }, - { "st-256color", NULL, "htop", 0, 1, -1 }, + /* class instance title tags mask iscentered isfloating monitor */ + { "stalonetray", NULL, NULL, 1 << 8, 1, 1, -1 }, + { "st-256color", NULL, "pulsemixer", 0, 1, 1, -1 }, + { "st-256color", NULL, "ncmpcpp", 0, 1, 1, -1 }, + { "st-256color", NULL, "tmux", 0, 1, 1, -1 }, + { "st-256color", NULL, "htop", 0, 1, 1, -1 }, }; diff --git a/dwm b/dwm index 33859fe..029e1f6 100755 Binary files a/dwm and b/dwm differ diff --git a/dwm.c b/dwm.c index bb04ecd..74d7beb 100644 --- a/dwm.c +++ b/dwm.c @@ -92,7 +92,7 @@ struct Client { int basew, baseh, incw, inch, maxw, maxh, minw, minh; int bw, oldbw; unsigned int tags; - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen; Client *next; Client *snext; Monitor *mon; @@ -139,6 +139,7 @@ typedef struct { const char *instance; const char *title; unsigned int tags; + int iscentered; int isfloating; int monitor; } Rule; @@ -308,6 +309,7 @@ applyrules(Client *c) && (!r->class || strstr(class, r->class)) && (!r->instance || strstr(instance, r->instance))) { + c->iscentered = r->iscentered; c->isfloating = r->isfloating; c->tags |= r->tags; for (m = mons; m && m->num != r->monitor; m = m->next); @@ -1081,6 +1083,11 @@ manage(Window w, XWindowAttributes *wa) && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); c->bw = borderpx; + if(c->iscentered) { + c->x = (c->mon->mw - WIDTH(c)) / 2; + c->y = (c->mon->mh - HEIGHT(c)) / 2; + } + wc.border_width = c->bw; XConfigureWindow(dpy, w, CWBorderWidth, &wc); XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); diff --git a/dwm.o b/dwm.o index a06e4b5..ae6af60 100644 Binary files a/dwm.o and b/dwm.o differ diff --git a/patches/dwm-center-6.1.diff b/patches/dwm-center-6.1.diff new file mode 100644 index 0000000..b4a49e1 --- /dev/null +++ b/patches/dwm-center-6.1.diff @@ -0,0 +1,58 @@ +diff --git a/config.def.h b/config.def.h +index 7054c06..e0cdcf3 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -24,9 +24,9 @@ static const Rule rules[] = { + * WM_CLASS(STRING) = instance, class + * WM_NAME(STRING) = title + */ +- /* class instance title tags mask isfloating monitor */ +- { "Gimp", NULL, NULL, 0, 1, -1 }, +- { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, ++ /* class instance title tags mask iscentered isfloating monitor */ ++ { "Gimp", NULL, NULL, 0, 0, 1, -1 }, ++ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 }, + }; + + /* layout(s) */ +diff --git a/dwm.c b/dwm.c +index 0362114..4aaaa60 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -92,7 +92,7 @@ struct Client { + int basew, baseh, incw, inch, maxw, maxh, minw, minh; + int bw, oldbw; + unsigned int tags; +- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; ++ int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + Client *next; + Client *snext; + Monitor *mon; +@@ -137,6 +137,7 @@ typedef struct { + const char *instance; + const char *title; + unsigned int tags; ++ int iscentered; + int isfloating; + int monitor; + } Rule; +@@ -296,6 +297,7 @@ applyrules(Client *c) + && (!r->class || strstr(class, r->class)) + && (!r->instance || strstr(instance, r->instance))) + { ++ c->iscentered = r->iscentered; + c->isfloating = r->isfloating; + c->tags |= r->tags; + for (m = mons; m && m->num != r->monitor; m = m->next); +@@ -1063,6 +1065,11 @@ manage(Window w, XWindowAttributes *wa) + && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); + c->bw = borderpx; + ++ if(c->iscentered) { ++ c->x = (c->mon->mw - WIDTH(c)) / 2; ++ c->y = (c->mon->mh - HEIGHT(c)) / 2; ++ } ++ + wc.border_width = c->bw; + XConfigureWindow(dpy, w, CWBorderWidth, &wc); + XSetWindowBorder(dpy, w, scheme[SchemeNorm].border->pix);