Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
d34b4c7b9a | |||
1f9614f82e | |||
4491bdda69 | |||
8af1d97332 | |||
79cd408844 | |||
18be893b66 | |||
0fb1842fd0 | |||
f522930a99 | |||
aebd745f72 | |||
c53980cddc | |||
95e56ffc0d | |||
f1294353f2 | |||
6649dcce6d | |||
58f2fe3f6a | |||
0aaa9a21f3 | |||
4f8b08d330 | |||
849e631510 | |||
789717d109 | |||
605630c145 | |||
1e7e57dad3 | |||
eb184e02ea | |||
ed41473634 | |||
ee5ba14431 |
1
.hgtags
1
.hgtags
@ -1 +1,2 @@
|
||||
d31b5ad96b0ba7b5b0a30928fcf000428339a577 0.1
|
||||
0a6472e2203994bc5738d40a340d26f7ec9d6062 0.2
|
||||
|
4
Makefile
4
Makefile
@ -8,10 +8,10 @@ OBJ = ${SRC:.c=.o}
|
||||
MAN1 = dwm.1
|
||||
BIN = dwm
|
||||
|
||||
all: config dwm
|
||||
all: options dwm
|
||||
@echo finished
|
||||
|
||||
config:
|
||||
options:
|
||||
@echo dwm build options:
|
||||
@echo "LIBS = ${LIBS}"
|
||||
@echo "CFLAGS = ${CFLAGS}"
|
||||
|
4
README
4
README
@ -36,5 +36,5 @@ This will start dwm on display :1 of the host foo.bar.
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
The configuration of dwm is done by customizing the wm.h source file. To
|
||||
customize the key bindings edit dev.c.
|
||||
The configuration of dwm is done by customizing source code,
|
||||
grep for CUSTOMIZE keyword.
|
||||
|
171
client.c
171
client.c
@ -16,16 +16,20 @@ resizetitle(Client *c)
|
||||
{
|
||||
int i;
|
||||
|
||||
c->tw = 0;
|
||||
c->bw = 0;
|
||||
for(i = 0; i < TLast; i++)
|
||||
if(c->tags[i])
|
||||
c->tw += textw(c->tags[i]);
|
||||
c->tw += textw(c->name);
|
||||
if(c->tw > c->w)
|
||||
c->tw = c->w + 2;
|
||||
c->tx = c->x + c->w - c->tw + 2;
|
||||
c->ty = c->y;
|
||||
XMoveResizeWindow(dpy, c->title, c->tx, c->ty, c->tw, c->th);
|
||||
c->bw += textw(c->tags[i]);
|
||||
c->bw += textw(c->name);
|
||||
if(c->bw > *c->w)
|
||||
c->bw = *c->w + 2;
|
||||
c->bx = *c->x + *c->w - c->bw + 2;
|
||||
c->by = *c->y;
|
||||
if(c->tags[tsel])
|
||||
XMoveResizeWindow(dpy, c->title, c->bx, c->by, c->bw, c->bh);
|
||||
else
|
||||
XMoveResizeWindow(dpy, c->title, c->bx + 2 * sw, c->by, c->bw, c->bh);
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
@ -39,8 +43,8 @@ xerrordummy(Display *dsply, XErrorEvent *ee)
|
||||
void
|
||||
ban(Client *c)
|
||||
{
|
||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
||||
XMoveWindow(dpy, c->title, c->tx + 2 * sw, c->ty);
|
||||
XMoveWindow(dpy, c->win, *c->x + 2 * sw, *c->y);
|
||||
XMoveWindow(dpy, c->title, c->bx + 2 * sw, c->by);
|
||||
}
|
||||
|
||||
void
|
||||
@ -66,8 +70,8 @@ focusnext(Arg *arg)
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
if(!(c = getnext(sel->next)))
|
||||
c = getnext(clients);
|
||||
if(!(c = getnext(sel->next, tsel)))
|
||||
c = getnext(clients, tsel);
|
||||
if(c) {
|
||||
higher(c);
|
||||
c->revert = sel;
|
||||
@ -124,12 +128,12 @@ gravitate(Client *c, Bool invert)
|
||||
case EastGravity:
|
||||
case CenterGravity:
|
||||
case WestGravity:
|
||||
dy = -(c->h / 2) + c->border;
|
||||
dy = -(*c->h / 2) + c->border;
|
||||
break;
|
||||
case SouthEastGravity:
|
||||
case SouthGravity:
|
||||
case SouthWestGravity:
|
||||
dy = -c->h;
|
||||
dy = -(*c->h);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -145,12 +149,12 @@ gravitate(Client *c, Bool invert)
|
||||
case NorthGravity:
|
||||
case CenterGravity:
|
||||
case SouthGravity:
|
||||
dx = -(c->w / 2) + c->border;
|
||||
dx = -(*c->w / 2) + c->border;
|
||||
break;
|
||||
case NorthEastGravity:
|
||||
case EastGravity:
|
||||
case SouthEastGravity:
|
||||
dx = -(c->w + c->border);
|
||||
dx = -(*c->w + c->border);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -160,8 +164,8 @@ gravitate(Client *c, Bool invert)
|
||||
dx = -dx;
|
||||
dy = -dy;
|
||||
}
|
||||
c->x += dx;
|
||||
c->y += dy;
|
||||
*c->x += dx;
|
||||
*c->y += dy;
|
||||
}
|
||||
|
||||
void
|
||||
@ -192,19 +196,27 @@ lower(Client *c)
|
||||
void
|
||||
manage(Window w, XWindowAttributes *wa)
|
||||
{
|
||||
int diff;
|
||||
Client *c;
|
||||
XSetWindowAttributes twa;
|
||||
Window trans;
|
||||
|
||||
c = emallocz(sizeof(Client));
|
||||
c->win = w;
|
||||
c->tx = c->x = wa->x;
|
||||
c->ty = c->y = wa->y;
|
||||
if(c->y < bh)
|
||||
c->ty = c->y += bh;
|
||||
c->tw = c->w = wa->width;
|
||||
c->h = wa->height;
|
||||
c->th = bh;
|
||||
c->bx = c->fx = c->tx = wa->x;
|
||||
c->by = c->fy = c->ty = wa->y;
|
||||
c->bw = c->fw = c->tw = wa->width;
|
||||
c->fh = c->th = wa->height;
|
||||
c->bh = bh;
|
||||
|
||||
diff = sw - c->fw;
|
||||
c->fx = random() % (diff ? diff : 1);
|
||||
diff = sh - c->fh - bh;
|
||||
c->fy = random() % (diff ? diff : 1);
|
||||
|
||||
if(c->fy < bh)
|
||||
c->by = c->fy = c->ty = bh;
|
||||
|
||||
c->border = 1;
|
||||
c->proto = getproto(c->win);
|
||||
setsize(c);
|
||||
@ -215,12 +227,11 @@ manage(Window w, XWindowAttributes *wa)
|
||||
twa.background_pixmap = ParentRelative;
|
||||
twa.event_mask = ExposureMask;
|
||||
|
||||
c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
|
||||
c->title = XCreateWindow(dpy, root, c->bx, c->by, c->bw, c->bh,
|
||||
0, DefaultDepth(dpy, screen), CopyFromParent,
|
||||
DefaultVisual(dpy, screen),
|
||||
CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
|
||||
|
||||
settitle(c);
|
||||
settags(c);
|
||||
|
||||
c->next = clients;
|
||||
@ -239,7 +250,11 @@ manage(Window w, XWindowAttributes *wa)
|
||||
c->isfloat = trans
|
||||
|| ((c->maxw == c->minw) && (c->maxh == c->minh));
|
||||
|
||||
setgeom(c);
|
||||
settitle(c);
|
||||
|
||||
arrange(NULL);
|
||||
|
||||
/* mapping the window now prevents flicker */
|
||||
if(c->tags[tsel]) {
|
||||
XMapRaised(dpy, c->win);
|
||||
@ -247,10 +262,8 @@ manage(Window w, XWindowAttributes *wa)
|
||||
focus(c);
|
||||
}
|
||||
else {
|
||||
ban(c);
|
||||
XMapRaised(dpy, c->win);
|
||||
XMapRaised(dpy, c->title);
|
||||
XSync(dpy, False);
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,47 +272,67 @@ maximize(Arg *arg)
|
||||
{
|
||||
if(!sel)
|
||||
return;
|
||||
sel->x = sx;
|
||||
sel->y = sy + bh;
|
||||
sel->w = sw - 2 * sel->border;
|
||||
sel->h = sh - 2 * sel->border - bh;
|
||||
*sel->x = sx;
|
||||
*sel->y = sy + bh;
|
||||
*sel->w = sw - 2 * sel->border;
|
||||
*sel->h = sh - 2 * sel->border - bh;
|
||||
higher(sel);
|
||||
resize(sel, False);
|
||||
resize(sel, False, TopLeft);
|
||||
}
|
||||
|
||||
void
|
||||
resize(Client *c, Bool inc)
|
||||
pop(Client *c)
|
||||
{
|
||||
Client **l;
|
||||
for(l = &clients; *l && *l != c; l = &(*l)->next);
|
||||
*l = c->next;
|
||||
|
||||
c->next = clients; /* pop */
|
||||
clients = c;
|
||||
arrange(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
resize(Client *c, Bool inc, Corner sticky)
|
||||
{
|
||||
XConfigureEvent e;
|
||||
int right = *c->x + *c->w;
|
||||
int bottom = *c->y + *c->h;
|
||||
|
||||
if(inc) {
|
||||
if(c->incw)
|
||||
c->w -= (c->w - c->basew) % c->incw;
|
||||
*c->w -= (*c->w - c->basew) % c->incw;
|
||||
if(c->inch)
|
||||
c->h -= (c->h - c->baseh) % c->inch;
|
||||
*c->h -= (*c->h - c->baseh) % c->inch;
|
||||
}
|
||||
if(c->x > sw) /* might happen on restart */
|
||||
c->x = sw - c->w;
|
||||
if(c->y > sh)
|
||||
c->ty = c->y = sh - c->h;
|
||||
if(c->minw && c->w < c->minw)
|
||||
c->w = c->minw;
|
||||
if(c->minh && c->h < c->minh)
|
||||
c->h = c->minh;
|
||||
if(c->maxw && c->w > c->maxw)
|
||||
c->w = c->maxw;
|
||||
if(c->maxh && c->h > c->maxh)
|
||||
c->h = c->maxh;
|
||||
if(*c->x > sw) /* might happen on restart */
|
||||
*c->x = sw - *c->w;
|
||||
if(*c->y > sh)
|
||||
*c->y = sh - *c->h;
|
||||
if(c->minw && *c->w < c->minw)
|
||||
*c->w = c->minw;
|
||||
if(c->minh && *c->h < c->minh)
|
||||
*c->h = c->minh;
|
||||
if(c->maxw && *c->w > c->maxw)
|
||||
*c->w = c->maxw;
|
||||
if(c->maxh && *c->h > c->maxh)
|
||||
*c->h = c->maxh;
|
||||
if(sticky == TopRight || sticky == BotRight)
|
||||
*c->x = right - *c->w;
|
||||
if(sticky == BotLeft || sticky == BotRight)
|
||||
*c->y = bottom - *c->h;
|
||||
|
||||
resizetitle(c);
|
||||
XSetWindowBorderWidth(dpy, c->win, 1);
|
||||
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
|
||||
XMoveResizeWindow(dpy, c->win, *c->x, *c->y, *c->w, *c->h);
|
||||
|
||||
e.type = ConfigureNotify;
|
||||
e.event = c->win;
|
||||
e.window = c->win;
|
||||
e.x = c->x;
|
||||
e.y = c->y;
|
||||
e.width = c->w;
|
||||
e.height = c->h;
|
||||
e.x = *c->x;
|
||||
e.y = *c->y;
|
||||
e.width = *c->w;
|
||||
e.height = *c->h;
|
||||
e.border_width = c->border;
|
||||
e.above = None;
|
||||
e.override_redirect = False;
|
||||
@ -307,6 +340,23 @@ resize(Client *c, Bool inc)
|
||||
XSync(dpy, False);
|
||||
}
|
||||
|
||||
void
|
||||
setgeom(Client *c)
|
||||
{
|
||||
if((arrange == dotile) && !c->isfloat) {
|
||||
c->x = &c->tx;
|
||||
c->y = &c->ty;
|
||||
c->w = &c->tw;
|
||||
c->h = &c->th;
|
||||
}
|
||||
else {
|
||||
c->x = &c->fx;
|
||||
c->y = &c->fy;
|
||||
c->w = &c->fw;
|
||||
c->h = &c->fh;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
setsize(Client *c)
|
||||
{
|
||||
@ -405,21 +455,16 @@ unmanage(Client *c)
|
||||
void
|
||||
zoom(Arg *arg)
|
||||
{
|
||||
Client **l, *c;
|
||||
Client *c;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
if(sel == getnext(clients) && sel->next) {
|
||||
if((c = getnext(sel->next)))
|
||||
if(sel == getnext(clients, tsel) && sel->next) {
|
||||
if((c = getnext(sel->next, tsel)))
|
||||
sel = c;
|
||||
}
|
||||
|
||||
for(l = &clients; *l && *l != sel; l = &(*l)->next);
|
||||
*l = sel->next;
|
||||
|
||||
sel->next = clients; /* pop */
|
||||
clients = sel;
|
||||
arrange(NULL);
|
||||
pop(sel);
|
||||
focus(sel);
|
||||
}
|
||||
|
13
config.mk
13
config.mk
@ -2,24 +2,23 @@
|
||||
|
||||
# paths
|
||||
PREFIX = /usr/local
|
||||
CONFPREFIX = ${PREFIX}/etc
|
||||
MANPREFIX = ${PREFIX}/share/man
|
||||
|
||||
X11INC = /usr/X11R6/include
|
||||
X11LIB = /usr/X11R6/lib
|
||||
|
||||
VERSION = 0.2
|
||||
VERSION = 0.3
|
||||
|
||||
# includes and libs
|
||||
LIBS = -L${PREFIX}/lib -L/usr/lib -lc -L${X11LIB} -lX11
|
||||
|
||||
# Linux/BSD
|
||||
#CFLAGS = -Os -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
|
||||
# -DVERSION=\"${VERSION}\"
|
||||
#LDFLAGS = ${LIBS}
|
||||
CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
|
||||
CFLAGS = -Os -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
|
||||
-DVERSION=\"${VERSION}\"
|
||||
LDFLAGS = -g ${LIBS}
|
||||
LDFLAGS = ${LIBS}
|
||||
#CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
|
||||
# -DVERSION=\"${VERSION}\"
|
||||
#LDFLAGS = -g ${LIBS}
|
||||
|
||||
|
||||
# Solaris
|
||||
|
2
draw.c
2
draw.c
@ -97,7 +97,7 @@ drawall()
|
||||
{
|
||||
Client *c;
|
||||
|
||||
for(c = clients; c; c = getnext(c->next))
|
||||
for(c = clients; c; c = getnext(c->next, tsel))
|
||||
drawtitle(c);
|
||||
drawstatus();
|
||||
}
|
||||
|
10
dwm.1
10
dwm.1
@ -90,7 +90,15 @@ Lock
|
||||
.B Control-[0..n]
|
||||
Append
|
||||
.B nth
|
||||
tag to cureent
|
||||
tag to current
|
||||
.B window
|
||||
.TP
|
||||
.B Control-Shift-[0..n]
|
||||
Replace current
|
||||
.B window
|
||||
of
|
||||
.B nth
|
||||
tag with current tag.
|
||||
.B window
|
||||
.TP
|
||||
.B Control-Button1
|
||||
|
18
dwm.h
18
dwm.h
@ -25,8 +25,9 @@ enum { Tscratch, Tdev, Twww, Twork, TLast };
|
||||
/********** CUSTOMIZE **********/
|
||||
|
||||
typedef union Arg Arg;
|
||||
typedef struct DC DC;
|
||||
typedef struct Client Client;
|
||||
typedef enum Corner Corner;
|
||||
typedef struct DC DC;
|
||||
typedef struct Fnt Fnt;
|
||||
typedef struct Key Key;
|
||||
typedef struct Rule Rule;
|
||||
@ -43,6 +44,8 @@ enum { WMProtocols, WMDelete, WMLast };
|
||||
/* cursor */
|
||||
enum { CurNormal, CurResize, CurMove, CurLast };
|
||||
|
||||
enum Corner { TopLeft, TopRight, BotLeft, BotRight };
|
||||
|
||||
struct Fnt {
|
||||
int ascent;
|
||||
int descent;
|
||||
@ -65,8 +68,10 @@ struct Client {
|
||||
char name[256];
|
||||
char *tags[TLast];
|
||||
int proto;
|
||||
int x, y, w, h;
|
||||
int tx, ty, tw, th;
|
||||
int *x, *y, *w, *h; /* current geom */
|
||||
int bx, by, bw, bh; /* title bar */
|
||||
int fx, fy, fw, fh; /* floating geom */
|
||||
int tx, ty, tw, th; /* tiled geom */
|
||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||
int grav;
|
||||
unsigned int border;
|
||||
@ -118,7 +123,9 @@ extern void killclient(Arg *arg);
|
||||
extern void lower(Client *c);
|
||||
extern void manage(Window w, XWindowAttributes *wa);
|
||||
extern void maximize(Arg *arg);
|
||||
extern void resize(Client *c, Bool inc);
|
||||
extern void pop(Client *c);
|
||||
extern void resize(Client *c, Bool inc, Corner sticky);
|
||||
extern void setgeom(Client *c);
|
||||
extern void setsize(Client *c);
|
||||
extern void settitle(Client *c);
|
||||
extern void unmanage(Client *c);
|
||||
@ -145,7 +152,8 @@ extern int xerror(Display *dsply, XErrorEvent *ee);
|
||||
extern void appendtag(Arg *arg);
|
||||
extern void dofloat(Arg *arg);
|
||||
extern void dotile(Arg *arg);
|
||||
extern Client *getnext(Client *c);
|
||||
extern Client *getnext(Client *c, unsigned int t);
|
||||
extern void heretag(Arg *arg);
|
||||
extern void replacetag(Arg *arg);
|
||||
extern void settags(Client *c);
|
||||
extern void view(Arg *arg);
|
||||
|
89
dwm.html
89
dwm.html
@ -21,85 +21,98 @@
|
||||
<p>
|
||||
dwm is a dynamic window manager for X11.
|
||||
</p>
|
||||
<h3>Philosophy</h3>
|
||||
<h4>Philosophy</h4>
|
||||
<p>
|
||||
As founder and main developer of wmii I came to the conclusion that
|
||||
wmii is too clunky for my needs. I don't need so many funky features
|
||||
and all this hype about remote control through a 9P service, I only
|
||||
want to manage my windows in a simple, but dynamic way. wmii never got
|
||||
finished because I listened to users, who proposed arbitrary ideas I
|
||||
considered useful. This resulted in an extreme <a href="http://www.jwz.org/doc/cadt.html">CADT</a>
|
||||
development model, which was a mistake. Thus the philosophy of
|
||||
dwm is simply <i>to fit my needs</i> (maybe yours as well). That's it.
|
||||
considered useful. This resulted in an extreme <a
|
||||
href="http://www.jwz.org/doc/cadt.html">CADT</a> development model,
|
||||
which was a mistake. Thus the philosophy of dwm is simply <i>to fit my
|
||||
needs</i> (maybe yours as well). That's it.
|
||||
</p>
|
||||
<h3>Differences to wmii</h3
|
||||
<h4>Differences to ion, larswm, and wmii</h4>
|
||||
<p>
|
||||
In contrast to wmii, dwm is only a window manager, and nothing else.
|
||||
Hence, it is much smaller, faster and simpler.
|
||||
In contrast to ion, larswm, and wmii, dwm is much smaller, faster and simpler.
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
dwm has no 9P support, no editable tagbars, no shell-based
|
||||
configuration and remote control and comes without any additional
|
||||
tools like printing the selection or warping the mouse.
|
||||
dwm has no Lua integration, no 9P support, no menu, no editable
|
||||
tagbars, no shell-based configuration, no remote control, and comes
|
||||
without any additional tools like printing the selection or warping
|
||||
the mouse.
|
||||
</li>
|
||||
<li>
|
||||
dwm is only a single binary, it's source code is intended to never
|
||||
exceed 2000 SLOC.
|
||||
</li>
|
||||
<li>
|
||||
dwm is customized through editing its source code, that makes it
|
||||
extremely fast and secure - it does not process any input data which
|
||||
hasn't been known at compile time, except window title names.
|
||||
</li>
|
||||
<li>
|
||||
dwm is based on tagging and dynamic window management (however simpler
|
||||
than wmii or larswm).
|
||||
dwm is based on tagging and dynamic window management (however
|
||||
simpler than ion, wmii or larswm). It manages windows in
|
||||
tiling and floating modes. Either mode can be applied dynamically,
|
||||
depending on the application in use and the task performed.
|
||||
</li>
|
||||
<li>
|
||||
dwm don't distinguishes between layers, there is no floating or
|
||||
managed layer. Wether the clients of currently selected tag are
|
||||
managed or not, you can re-arrange all clients on the fly. Popup-
|
||||
and fixed-size windows are treated unmanaged.
|
||||
tiled layer. Wether the clients of currently selected tag are in
|
||||
tiled mode or not, you can re-arrange all clients on the fly.
|
||||
Popup- and fixed-size windows are treated floating, however.
|
||||
</li>
|
||||
<li>
|
||||
dwm is customized through editing its source code, that makes it
|
||||
extremely fast and secure - it does not process any input data
|
||||
which hasn't been known at compile time, except window title names
|
||||
and status text read from standard input. You don't have to learn
|
||||
Lua/sh/ruby or some weird configuration file format (like X
|
||||
resource files), beside C to customize it for your needs,
|
||||
you <b>only</b> have to learn C.
|
||||
</li>
|
||||
<li>
|
||||
Because dwm is customized through editing its source code, it's
|
||||
pointless to make binary packages of it. This keeps its userbase
|
||||
small and elitist. No novices asking stupid questions.
|
||||
</li>
|
||||
<li>
|
||||
dwm uses 1-pixel borders to provide the maximum of screen real
|
||||
estate to clients. Small titlebars are only drawn in front of unfocused
|
||||
clients.
|
||||
estate to clients. Small titlebars are only drawn in front of
|
||||
unfocused clients.
|
||||
</li>
|
||||
<li>
|
||||
dwm reads from <b>stdin</b> to print arbitrary status text (like the
|
||||
date, load, battery charge). That's much simpler than larsremote,
|
||||
wmiir and what not...
|
||||
dwm reads from standard input to print arbitrary status text (like
|
||||
the date, load, battery charge). That's much simpler than
|
||||
larsremote, wmiir and what not...
|
||||
</li>
|
||||
<li>
|
||||
Anselm <b>does not</b> want any feedback to dwm. If you ask for support,
|
||||
feature requests, or if you report bugs, they will be <b>ignored</b>
|
||||
with a high chance. dwm is only intended to fit Anselms needs.
|
||||
However you are free to download and distribute/relicense it, with the
|
||||
conditions of the <a href="http://wmii.de/cgi-bin/hgwebdir.cgi/dwm?f=f10eb1139362;file=LICENSE;style=raw">MIT/X Consortium license</a>.
|
||||
It can be downloaded and distributed under the conditions
|
||||
of the <a href="http://10kloc.org/cgi-bin/hgwebdir.cgi/dwm?f=f10eb1139362;file=LICENSE;style=raw">MIT/X Consortium license</a>.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Screenshot</h3>
|
||||
<p>
|
||||
<a href="http://wmii.de/shots/dwm-20060714.png">Click here for a screenshot</a> (20060714)
|
||||
</p>
|
||||
<h4>Links</h4>
|
||||
<ul>
|
||||
<li><a href="http://10kloc.org/cgi-bin/man/man2html?query=dwm">Man page</a></li>
|
||||
<li><a href="http://10kloc.org/shots/dwm-20060714.png">Screenshot</a> (20060714)</li>
|
||||
<li><a href="http://10kloc.org/download/poster.ps">A4 poster (PostScript)</a></li>
|
||||
<li>Mailing List: <a href="http://10kloc.org/cgi-bin/mailman/listinfo/dwm">dwm at wmii dot de</a> <a href="http://10kloc.org/pipermail/dwm/">(Archives)</a></li>
|
||||
<li>IRC channel: <code>#dwm</code> at <code>irc.oftc.net</code></li>
|
||||
</ul>
|
||||
<h3>Development</h3>
|
||||
<p>
|
||||
dwm is actively developed in parallel to wmii. You can <a href="http://wmii.de/cgi-bin/hgwebdir.cgi/dwm">browse</a> its source code repository or get a copy using <a href="http://www.selenic.com/mercurial/">Mercurial</a> with following command:
|
||||
dwm is actively developed in parallel to wmii. You can <a href="http://10kloc.org/cgi-bin/hgwebdir.cgi/dwm">browse</a> its source code repository or get a copy using <a href="http://www.selenic.com/mercurial/">Mercurial</a> with following command:
|
||||
</p>
|
||||
<p>
|
||||
<code>hg clone http://wmii.de/cgi-bin/hgwebdir.cgi/dwm</code>
|
||||
<code>hg clone http://10kloc.org/cgi-bin/hgwebdir.cgi/dwm</code>
|
||||
</p>
|
||||
<h3>Download</h3>
|
||||
<ul>
|
||||
<li><a href="http://wmii.de/download/dwm-0.2.tar.gz">dwm 0.2</a> (13kb) (20060717)</li>
|
||||
<li><a href="http://10kloc.org/download/dwm-0.3.tar.gz">dwm 0.3</a> (13kb) (20060719)</li>
|
||||
</ul>
|
||||
<h3>Miscellaneous</h3>
|
||||
<p>
|
||||
You can purchase this <a href="https://www.spreadshirt.net/shop.php?op=article&article_id=3298632&view=403">tricot</a>
|
||||
if you like dwm and the dwm logo, which has been designed by Anselm.
|
||||
</p>
|
||||
<p><small>--Anselm (20060714)</small></p>
|
||||
<p><small>--Anselm (20060719)</small></p>
|
||||
</body>
|
||||
</html>
|
||||
|
77
event.c
77
event.c
@ -12,13 +12,7 @@
|
||||
#define MouseMask (ButtonMask | PointerMotionMask)
|
||||
|
||||
/* CUSTOMIZE */
|
||||
const char *browse[] = { "firefox", NULL };
|
||||
const char *gimp[] = { "gimp", NULL };
|
||||
const char *term[] = {
|
||||
"urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white",
|
||||
"-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL
|
||||
};
|
||||
const char *xlock[] = { "xlock", NULL };
|
||||
const char *term[] = { "xterm", NULL };
|
||||
|
||||
Key key[] = {
|
||||
/* modifier key function arguments */
|
||||
@ -35,16 +29,17 @@ Key key[] = {
|
||||
{ Mod1Mask, XK_m, maximize, { 0 } },
|
||||
{ Mod1Mask, XK_space, dotile, { 0 } },
|
||||
{ Mod1Mask, XK_Return, zoom, { 0 } },
|
||||
{ ControlMask|ShiftMask,XK_0, heretag, { .i = Tscratch } },
|
||||
{ ControlMask|ShiftMask,XK_1, heretag, { .i = Tdev } },
|
||||
{ ControlMask|ShiftMask,XK_2, heretag, { .i = Twww } },
|
||||
{ ControlMask|ShiftMask,XK_3, heretag, { .i = Twork } },
|
||||
{ Mod1Mask|ShiftMask, XK_0, replacetag, { .i = Tscratch } },
|
||||
{ Mod1Mask|ShiftMask, XK_1, replacetag, { .i = Tdev } },
|
||||
{ Mod1Mask|ShiftMask, XK_2, replacetag, { .i = Twww } },
|
||||
{ Mod1Mask|ShiftMask, XK_3, replacetag, { .i = Twork } },
|
||||
{ Mod1Mask|ShiftMask, XK_c, killclient, { 0 } },
|
||||
{ Mod1Mask|ShiftMask, XK_g, spawn, { .argv = gimp } },
|
||||
{ Mod1Mask|ShiftMask, XK_l, spawn, { .argv = xlock } },
|
||||
{ Mod1Mask|ShiftMask, XK_q, quit, { 0 } },
|
||||
{ Mod1Mask|ShiftMask, XK_space, dofloat, { 0 } },
|
||||
{ Mod1Mask|ShiftMask, XK_w, spawn, { .argv = browse } },
|
||||
{ Mod1Mask|ShiftMask, XK_Return, spawn, { .argv = term } },
|
||||
};
|
||||
|
||||
@ -58,8 +53,8 @@ movemouse(Client *c)
|
||||
unsigned int dui;
|
||||
Window dummy;
|
||||
|
||||
ocx = c->x;
|
||||
ocy = c->y;
|
||||
ocx = *c->x;
|
||||
ocy = *c->y;
|
||||
if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync,
|
||||
None, cursor[CurMove], CurrentTime) != GrabSuccess)
|
||||
return;
|
||||
@ -73,9 +68,9 @@ movemouse(Client *c)
|
||||
break;
|
||||
case MotionNotify:
|
||||
XSync(dpy, False);
|
||||
c->x = ocx + (ev.xmotion.x - x1);
|
||||
c->y = ocy + (ev.xmotion.y - y1);
|
||||
resize(c, False);
|
||||
*c->x = ocx + (ev.xmotion.x - x1);
|
||||
*c->y = ocy + (ev.xmotion.y - y1);
|
||||
resize(c, False, TopLeft);
|
||||
break;
|
||||
case ButtonRelease:
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
@ -89,13 +84,14 @@ resizemouse(Client *c)
|
||||
{
|
||||
XEvent ev;
|
||||
int ocx, ocy;
|
||||
Corner sticky;
|
||||
|
||||
ocx = c->x;
|
||||
ocy = c->y;
|
||||
ocx = *c->x;
|
||||
ocy = *c->y;
|
||||
if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync,
|
||||
None, cursor[CurResize], CurrentTime) != GrabSuccess)
|
||||
return;
|
||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h);
|
||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, *c->w, *c->h);
|
||||
for(;;) {
|
||||
XMaskEvent(dpy, MouseMask | ExposureMask, &ev);
|
||||
switch(ev.type) {
|
||||
@ -105,11 +101,15 @@ resizemouse(Client *c)
|
||||
break;
|
||||
case MotionNotify:
|
||||
XSync(dpy, False);
|
||||
c->w = abs(ocx - ev.xmotion.x);
|
||||
c->h = abs(ocy - ev.xmotion.y);
|
||||
c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - c->w;
|
||||
c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - c->h;
|
||||
resize(c, True);
|
||||
*c->w = abs(ocx - ev.xmotion.x);
|
||||
*c->h = abs(ocy - ev.xmotion.y);
|
||||
*c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - *c->w;
|
||||
*c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - *c->h;
|
||||
if(ocx <= ev.xmotion.x)
|
||||
sticky = (ocy <= ev.xmotion.y) ? TopLeft : BotLeft;
|
||||
else
|
||||
sticky = (ocy <= ev.xmotion.y) ? TopRight : BotRight;
|
||||
resize(c, True, sticky);
|
||||
break;
|
||||
case ButtonRelease:
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
@ -149,24 +149,27 @@ buttonpress(XEvent *e)
|
||||
}
|
||||
}
|
||||
else if((c = getclient(ev->window))) {
|
||||
if(arrange == dotile && !c->isfloat) {
|
||||
if((ev->state & ControlMask) && (ev->button == Button1))
|
||||
zoom(NULL);
|
||||
return;
|
||||
}
|
||||
/* floating windows */
|
||||
higher(c);
|
||||
switch(ev->button) {
|
||||
default:
|
||||
break;
|
||||
case Button1:
|
||||
movemouse(c);
|
||||
if(arrange == dotile && !c->isfloat) {
|
||||
if((ev->state & ControlMask) && (ev->button == Button1))
|
||||
zoom(NULL);
|
||||
}
|
||||
else {
|
||||
higher(c);
|
||||
movemouse(c);
|
||||
}
|
||||
break;
|
||||
case Button2:
|
||||
lower(c);
|
||||
break;
|
||||
case Button3:
|
||||
resizemouse(c);
|
||||
if(arrange == dofloat || c->isfloat) {
|
||||
higher(c);
|
||||
resizemouse(c);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -183,17 +186,17 @@ configurerequest(XEvent *e)
|
||||
if((c = getclient(ev->window))) {
|
||||
gravitate(c, True);
|
||||
if(ev->value_mask & CWX)
|
||||
c->x = ev->x;
|
||||
*c->x = ev->x;
|
||||
if(ev->value_mask & CWY)
|
||||
c->y = ev->y;
|
||||
*c->y = ev->y;
|
||||
if(ev->value_mask & CWWidth)
|
||||
c->w = ev->width;
|
||||
*c->w = ev->width;
|
||||
if(ev->value_mask & CWHeight)
|
||||
c->h = ev->height;
|
||||
*c->h = ev->height;
|
||||
if(ev->value_mask & CWBorderWidth)
|
||||
c->border = 1;
|
||||
gravitate(c, False);
|
||||
resize(c, True);
|
||||
resize(c, True, TopLeft);
|
||||
}
|
||||
|
||||
wc.x = ev->x;
|
||||
|
12
main.c
12
main.c
@ -24,7 +24,7 @@ static void
|
||||
cleanup()
|
||||
{
|
||||
while(sel) {
|
||||
resize(sel, True);
|
||||
resize(sel, True, TopLeft);
|
||||
unmanage(sel);
|
||||
}
|
||||
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
|
||||
@ -179,14 +179,13 @@ main(int argc, char *argv[])
|
||||
|
||||
for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) {
|
||||
switch (argv[i][1]) {
|
||||
case 'v':
|
||||
fprintf(stdout, "%s",
|
||||
"dwm-"VERSION", (C)opyright MMVI Anselm R. Garbe\n");
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
eprint("usage: dwm [-v]\n");
|
||||
break;
|
||||
case 'v':
|
||||
fputs("dwm-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout);
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,6 +261,7 @@ main(int argc, char *argv[])
|
||||
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
|
||||
|
||||
strcpy(stext, "dwm-"VERSION);
|
||||
|
||||
scan();
|
||||
|
||||
/* main event loop, reads status text from stdin as well */
|
||||
|
72
tag.c
72
tag.c
@ -12,7 +12,7 @@
|
||||
/* CUSTOMIZE */
|
||||
static Rule rule[] = {
|
||||
/* class instance tags isfloat */
|
||||
{ "Firefox-bin", "Gecko", { [Twww] = "www" }, False },
|
||||
{ "Firefox-bin", "firefox-bin", { [Twww] = "www" }, False },
|
||||
};
|
||||
|
||||
/* extern */
|
||||
@ -43,13 +43,15 @@ dofloat(Arg *arg)
|
||||
|
||||
arrange = dofloat;
|
||||
for(c = clients; c; c = c->next) {
|
||||
if(c->tags[tsel])
|
||||
resize(c, True);
|
||||
setgeom(c);
|
||||
if(c->tags[tsel]) {
|
||||
resize(c, True, TopLeft);
|
||||
}
|
||||
else
|
||||
ban(c);
|
||||
}
|
||||
if(sel && !sel->tags[tsel]) {
|
||||
if((sel = getnext(clients))) {
|
||||
if((sel = getnext(clients, tsel))) {
|
||||
higher(sel);
|
||||
focus(sel);
|
||||
}
|
||||
@ -75,38 +77,45 @@ dotile(Arg *arg)
|
||||
h = sh - bh;
|
||||
|
||||
for(i = 0, c = clients; c; c = c->next) {
|
||||
setgeom(c);
|
||||
if(c->tags[tsel]) {
|
||||
if(c->isfloat) {
|
||||
higher(c);
|
||||
resize(c, True);
|
||||
resize(c, True, TopLeft);
|
||||
continue;
|
||||
}
|
||||
if(n == 1) {
|
||||
c->x = sx;
|
||||
c->y = sy + bh;
|
||||
c->w = sw - 2 * c->border;
|
||||
c->h = sh - 2 * c->border - bh;
|
||||
*c->x = sx;
|
||||
*c->y = sy + bh;
|
||||
*c->w = sw - 2 * c->border;
|
||||
*c->h = sh - 2 * c->border - bh;
|
||||
}
|
||||
else if(i == 0) {
|
||||
c->x = sx;
|
||||
c->y = sy + bh;
|
||||
c->w = mw - 2 * c->border;
|
||||
c->h = sh - 2 * c->border - bh;
|
||||
*c->x = sx;
|
||||
*c->y = sy + bh;
|
||||
*c->w = mw - 2 * c->border;
|
||||
*c->h = sh - 2 * c->border - bh;
|
||||
}
|
||||
else {
|
||||
c->x = sx + mw;
|
||||
c->y = sy + (i - 1) * h + bh;
|
||||
c->w = w - 2 * c->border;
|
||||
c->h = h - 2 * c->border;
|
||||
else if(h > bh) {
|
||||
*c->x = sx + mw;
|
||||
*c->y = sy + (i - 1) * h + bh;
|
||||
*c->w = w - 2 * c->border;
|
||||
*c->h = h - 2 * c->border;
|
||||
}
|
||||
resize(c, False);
|
||||
else { /* fallback if h < bh */
|
||||
*c->x = sx + mw;
|
||||
*c->y = sy + bh;
|
||||
*c->w = w - 2 * c->border;
|
||||
*c->h = sh - 2 * c->border - bh;
|
||||
}
|
||||
resize(c, False, TopLeft);
|
||||
i++;
|
||||
}
|
||||
else
|
||||
ban(c);
|
||||
}
|
||||
if(!sel || (sel && !sel->tags[tsel])) {
|
||||
if((sel = getnext(clients))) {
|
||||
if((sel = getnext(clients, tsel))) {
|
||||
higher(sel);
|
||||
focus(sel);
|
||||
}
|
||||
@ -115,12 +124,31 @@ dotile(Arg *arg)
|
||||
}
|
||||
|
||||
Client *
|
||||
getnext(Client *c)
|
||||
getnext(Client *c, unsigned int t)
|
||||
{
|
||||
for(; c && !c->tags[tsel]; c = c->next);
|
||||
for(; c && !c->tags[t]; c = c->next);
|
||||
return c;
|
||||
}
|
||||
|
||||
void
|
||||
heretag(Arg *arg)
|
||||
{
|
||||
int i;
|
||||
Client *c;
|
||||
|
||||
if(arg->i == tsel)
|
||||
return;
|
||||
|
||||
if(!(c = getnext(clients, arg->i)))
|
||||
return;
|
||||
|
||||
for(i = 0; i < TLast; i++)
|
||||
c->tags[i] = NULL;
|
||||
c->tags[tsel] = tags[tsel];
|
||||
pop(c);
|
||||
focus(c);
|
||||
}
|
||||
|
||||
void
|
||||
replacetag(Arg *arg)
|
||||
{
|
||||
|
6
util.c
6
util.c
@ -17,7 +17,7 @@ bad_malloc(unsigned int size)
|
||||
{
|
||||
fprintf(stderr, "fatal: could not malloc() %d bytes\n",
|
||||
(int) size);
|
||||
exit(1);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* extern */
|
||||
@ -37,7 +37,7 @@ eprint(const char *errstr, ...) {
|
||||
va_start(ap, errstr);
|
||||
vfprintf(stderr, errstr, ap);
|
||||
va_end(ap);
|
||||
exit(1);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void
|
||||
@ -55,7 +55,7 @@ spawn(Arg *arg)
|
||||
fprintf(stderr, "dwm: execvp %s", argv[0]);
|
||||
perror(" failed");
|
||||
}
|
||||
exit (0);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
wait(0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user