Applied center patch and updated the README

master
ronaldr1985 7 years ago
parent 7d708684a8
commit 5e8081bc6f

@ -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.

@ -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/

@ -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 },
};

BIN
dwm

Binary file not shown.

@ -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);

BIN
dwm.o

Binary file not shown.

@ -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);
Loading…
Cancel
Save