Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
2d7f59424c | |||
e256afe31e | |||
64cfebc5e7 | |||
7a095d0ce2 | |||
5052c538d9 | |||
22d8c6fd18 | |||
71857b87ee | |||
6ba400ee0f | |||
35e65ea640 | |||
d0d986dd0e | |||
9685e7dbc2 | |||
37f39afb8e | |||
dc9f62f393 | |||
7055315725 | |||
fd995dac78 | |||
e5765cdd84 | |||
8d0e58f80b | |||
8fcd1bfda8 | |||
e39e697998 | |||
d2dd58eabd | |||
c6fc6b173d | |||
4590d7877c | |||
f577fe4e27 |
1
.hgtags
1
.hgtags
@ -35,3 +35,4 @@ e1c8bef05e6e48df4f26471ea0712aa43ab9d949 3.1
|
||||
f2cabc83a18f9b5b548159329ddd4dee904fa31f 3.2.1
|
||||
d3876aa792923f9a95f7ad0c7f0134533404df35 3.2.2
|
||||
0f91934037b04221ff5d1ba3a6c39c1ff26e3661 3.3
|
||||
9ede7b2d2450537e750d5505789fbe63960e97e6 3.4
|
||||
|
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
||||
# dwm - dynamic window manager
|
||||
# (C)opyright MMVII Anselm R. Garbe
|
||||
# (C)opyright MMVI-MMVII Anselm R. Garbe
|
||||
|
||||
include config.mk
|
||||
|
||||
|
38
client.c
38
client.c
@ -69,19 +69,20 @@ xerrordummy(Display *dsply, XErrorEvent *ee) {
|
||||
|
||||
void
|
||||
configure(Client *c) {
|
||||
XEvent synev;
|
||||
XConfigureEvent ce;
|
||||
|
||||
synev.type = ConfigureNotify;
|
||||
synev.xconfigure.display = dpy;
|
||||
synev.xconfigure.event = c->win;
|
||||
synev.xconfigure.window = c->win;
|
||||
synev.xconfigure.x = c->x;
|
||||
synev.xconfigure.y = c->y;
|
||||
synev.xconfigure.width = c->w;
|
||||
synev.xconfigure.height = c->h;
|
||||
synev.xconfigure.border_width = c->border;
|
||||
synev.xconfigure.above = None;
|
||||
XSendEvent(dpy, c->win, True, NoEventMask, &synev);
|
||||
ce.type = ConfigureNotify;
|
||||
ce.display = dpy;
|
||||
ce.event = c->win;
|
||||
ce.window = c->win;
|
||||
ce.x = c->x;
|
||||
ce.y = c->y;
|
||||
ce.width = c->w;
|
||||
ce.height = c->h;
|
||||
ce.border_width = c->border;
|
||||
ce.above = None;
|
||||
ce.override_redirect = False;
|
||||
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
|
||||
}
|
||||
|
||||
void
|
||||
@ -147,7 +148,7 @@ killclient(Arg *arg) {
|
||||
|
||||
void
|
||||
manage(Window w, XWindowAttributes *wa) {
|
||||
Client *c;
|
||||
Client *c, *t;
|
||||
Window trans;
|
||||
|
||||
c = emallocz(sizeof(Client));
|
||||
@ -180,9 +181,10 @@ manage(Window w, XWindowAttributes *wa) {
|
||||
grabbuttons(c, False);
|
||||
XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
|
||||
updatetitle(c);
|
||||
settags(c, getclient(trans));
|
||||
t = getclient(trans);
|
||||
settags(c, t);
|
||||
if(!c->isfloat)
|
||||
c->isfloat = trans || c->isfixed;
|
||||
c->isfloat = (t != 0) || c->isfixed;
|
||||
if(clients)
|
||||
clients->prev = c;
|
||||
c->next = clients;
|
||||
@ -302,8 +304,8 @@ updatesizehints(Client *c) {
|
||||
}
|
||||
else
|
||||
c->minax = c->minay = c->maxax = c->maxay = 0;
|
||||
c->isfixed = (c->maxw && c->minw && c->maxh && c->minh &&
|
||||
c->maxw == c->minw && c->maxh == c->minh);
|
||||
c->isfixed = (c->maxw && c->minw && c->maxh && c->minh
|
||||
&& c->maxw == c->minw && c->maxh == c->minh);
|
||||
}
|
||||
|
||||
void
|
||||
@ -323,7 +325,7 @@ updatetitle(Client *c) {
|
||||
strncpy(c->name, (char *)name.value, sizeof c->name);
|
||||
else {
|
||||
if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success
|
||||
&& n > 0 && *list)
|
||||
&& n > 0 && *list)
|
||||
{
|
||||
strncpy(c->name, *list, sizeof c->name);
|
||||
XFreeStringList(list);
|
||||
|
@ -22,6 +22,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
|
||||
#define MODKEY Mod1Mask
|
||||
#define NMASTER 1 /* clients in master area */
|
||||
#define SNAP 40 /* pixel */
|
||||
#define TOPBAR True /* False */
|
||||
|
||||
#define KEYS \
|
||||
static Key key[] = { \
|
||||
@ -86,8 +87,8 @@ static Key key[] = { \
|
||||
#define RULES \
|
||||
static Rule rule[] = { \
|
||||
/* class:instance:title regex tags regex isfloat */ \
|
||||
{ "Firefox.*", "3", False }, \
|
||||
{ "Gimp.*", NULL, True }, \
|
||||
{ "MPlayer.*", NULL, True }, \
|
||||
{ "Acroread.*", NULL, True }, \
|
||||
{ "Firefox", "3", False }, \
|
||||
{ "Gimp", NULL, True }, \
|
||||
{ "MPlayer", NULL, True }, \
|
||||
{ "Acroread", NULL, True }, \
|
||||
};
|
||||
|
@ -22,6 +22,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
|
||||
#define MODKEY Mod1Mask
|
||||
#define NMASTER 1 /* clients in master area */
|
||||
#define SNAP 20 /* pixel */
|
||||
#define TOPBAR True /* False */
|
||||
|
||||
#define KEYS \
|
||||
static Key key[] = { \
|
||||
@ -83,5 +84,7 @@ static Key key[] = { \
|
||||
#define RULES \
|
||||
static Rule rule[] = { \
|
||||
/* class:instance:title regex tags regex isfloat */ \
|
||||
{ "Gimp.*", NULL, True }, \
|
||||
{ "Gimp", NULL, True }, \
|
||||
{ "MPlayer", NULL, True }, \
|
||||
{ "Acroread", NULL, True }, \
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
# dwm version
|
||||
VERSION = 3.4
|
||||
VERSION = 3.5
|
||||
|
||||
# Customize below to fit your system
|
||||
|
||||
|
4
dwm.1
4
dwm.1
@ -67,7 +67,7 @@ Focus next window.
|
||||
Focus previous window.
|
||||
.TP
|
||||
.B Mod1-Return
|
||||
Zooms/cycles current window to/from master area (tiling mode), toggles maximization current window (floating mode).
|
||||
Zooms/cycles current window to/from master area (tiling mode), toggles maximization of current window (floating mode).
|
||||
.TP
|
||||
.B Mod1-g
|
||||
Grow master area (tiling mode only).
|
||||
@ -124,7 +124,7 @@ Quit dwm.
|
||||
Move current window while dragging (floating mode only).
|
||||
.TP
|
||||
.B Mod1-Button2
|
||||
Zoom current window to the master area (tiling mode only).
|
||||
Zooms/cycles current window to/from master area (tiling mode), toggles maximization of current window (floating mode).
|
||||
.TP
|
||||
.B Mod1-Button3
|
||||
Resize current window while dragging (floating mode only).
|
||||
|
54
event.c
54
event.c
@ -82,7 +82,10 @@ resizemouse(Client *c) {
|
||||
switch(ev.type) {
|
||||
case ButtonRelease:
|
||||
resize(c, True);
|
||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0,
|
||||
c->w + c->border - 1, c->h + c->border - 1);
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||
return;
|
||||
case ConfigureRequest:
|
||||
case Expose:
|
||||
@ -153,8 +156,9 @@ buttonpress(XEvent *e) {
|
||||
}
|
||||
else if(ev->button == Button2)
|
||||
zoom(NULL);
|
||||
else if(ev->button == Button3 && (arrange == dofloat || c->isfloat) &&
|
||||
!c->isfixed) {
|
||||
else if(ev->button == Button3
|
||||
&& (arrange == dofloat || c->isfloat) && !c->isfixed)
|
||||
{
|
||||
restack();
|
||||
resizemouse(c);
|
||||
}
|
||||
@ -163,40 +167,32 @@ buttonpress(XEvent *e) {
|
||||
|
||||
static void
|
||||
configurerequest(XEvent *e) {
|
||||
unsigned long newmask;
|
||||
Client *c;
|
||||
XConfigureRequestEvent *ev = &e->xconfigurerequest;
|
||||
XWindowChanges wc;
|
||||
|
||||
if((c = getclient(ev->window))) {
|
||||
c->ismax = False;
|
||||
if(ev->value_mask & CWX)
|
||||
c->x = ev->x;
|
||||
if(ev->value_mask & CWY)
|
||||
c->y = ev->y;
|
||||
if(ev->value_mask & CWWidth)
|
||||
c->w = ev->width;
|
||||
if(ev->value_mask & CWHeight)
|
||||
c->h = ev->height;
|
||||
if(ev->value_mask & CWBorderWidth)
|
||||
c->border = ev->border_width;
|
||||
wc.x = c->x;
|
||||
wc.y = c->y;
|
||||
wc.width = c->w;
|
||||
wc.height = c->h;
|
||||
newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth));
|
||||
if(newmask)
|
||||
XConfigureWindow(dpy, c->win, newmask, &wc);
|
||||
else
|
||||
configure(c);
|
||||
XSync(dpy, False);
|
||||
if(c->isfloat) {
|
||||
if(c->isfixed || c->isfloat || (arrange == dofloat)) {
|
||||
if(ev->value_mask & CWX)
|
||||
c->x = ev->x;
|
||||
if(ev->value_mask & CWY)
|
||||
c->y = ev->y;
|
||||
if(ev->value_mask & CWWidth)
|
||||
c->w = ev->width;
|
||||
if(ev->value_mask & CWHeight)
|
||||
c->h = ev->height;
|
||||
if((ev->value_mask & (CWX | CWY))
|
||||
&& !(ev->value_mask & (CWWidth | CWHeight)))
|
||||
configure(c);
|
||||
resize(c, False);
|
||||
if(!isvisible(c))
|
||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
||||
}
|
||||
else
|
||||
arrange();
|
||||
configure(c);
|
||||
}
|
||||
else {
|
||||
wc.x = ev->x;
|
||||
@ -207,8 +203,8 @@ configurerequest(XEvent *e) {
|
||||
wc.sibling = ev->above;
|
||||
wc.stack_mode = ev->detail;
|
||||
XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
|
||||
XSync(dpy, False);
|
||||
}
|
||||
XSync(dpy, False);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -254,14 +250,13 @@ keypress(XEvent *e) {
|
||||
XKeyEvent *ev = &e->xkey;
|
||||
|
||||
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
|
||||
for(i = 0; i < len; i++) {
|
||||
for(i = 0; i < len; i++)
|
||||
if(keysym == key[i].keysym
|
||||
&& CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
|
||||
&& CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
|
||||
{
|
||||
if(key[i].func)
|
||||
key[i].func(&key[i].arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -290,11 +285,8 @@ maprequest(XEvent *e) {
|
||||
|
||||
if(!XGetWindowAttributes(dpy, ev->window, &wa))
|
||||
return;
|
||||
if(wa.override_redirect) {
|
||||
XSelectInput(dpy, ev->window,
|
||||
(StructureNotifyMask | PropertyChangeMask));
|
||||
if(wa.override_redirect)
|
||||
return;
|
||||
}
|
||||
if(!getclient(ev->window))
|
||||
manage(ev->window, &wa);
|
||||
}
|
||||
|
21
main.c
21
main.c
@ -18,11 +18,11 @@
|
||||
/* extern */
|
||||
|
||||
char stext[256];
|
||||
Bool *seltag;
|
||||
int bh, bmw, screen, sx, sy, sw, sh, wax, way, waw, wah;
|
||||
unsigned int master, nmaster, ntags, numlockmask;
|
||||
Atom wmatom[WMLast], netatom[NetLast];
|
||||
Bool running = True;
|
||||
Bool *seltag;
|
||||
Bool selscreen = True;
|
||||
Client *clients = NULL;
|
||||
Client *sel = NULL;
|
||||
@ -69,9 +69,8 @@ scan(void) {
|
||||
wins = NULL;
|
||||
if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) {
|
||||
for(i = 0; i < num; i++) {
|
||||
if(!XGetWindowAttributes(dpy, wins[i], &wa))
|
||||
continue;
|
||||
if(wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1))
|
||||
if(!XGetWindowAttributes(dpy, wins[i], &wa)
|
||||
|| wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1))
|
||||
continue;
|
||||
if(wa.map_state == IsViewable)
|
||||
manage(wins[i], &wa);
|
||||
@ -104,12 +103,12 @@ setup(void) {
|
||||
/* init modifier map */
|
||||
numlockmask = 0;
|
||||
modmap = XGetModifierMapping(dpy);
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (i = 0; i < 8; i++)
|
||||
for (j = 0; j < modmap->max_keypermod; j++) {
|
||||
if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock))
|
||||
if(modmap->modifiermap[i * modmap->max_keypermod + j]
|
||||
== XKeysymToKeycode(dpy, XK_Num_Lock))
|
||||
numlockmask = (1 << i);
|
||||
}
|
||||
}
|
||||
XFreeModifiermap(modmap);
|
||||
/* select for events */
|
||||
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
||||
@ -141,15 +140,15 @@ setup(void) {
|
||||
wa.override_redirect = 1;
|
||||
wa.background_pixmap = ParentRelative;
|
||||
wa.event_mask = ButtonPressMask | ExposureMask;
|
||||
barwin = XCreateWindow(dpy, root, sx, sy, sw, bh, 0, DefaultDepth(dpy, screen),
|
||||
CopyFromParent, DefaultVisual(dpy, screen),
|
||||
barwin = XCreateWindow(dpy, root, sx, sy + (TOPBAR ? 0 : sh - bh), sw, bh, 0,
|
||||
DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
|
||||
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
||||
XDefineCursor(dpy, barwin, cursor[CurNormal]);
|
||||
XMapRaised(dpy, barwin);
|
||||
strcpy(stext, "dwm-"VERSION);
|
||||
/* windowarea */
|
||||
wax = sx;
|
||||
way = sy + bh;
|
||||
way = sy + (TOPBAR ? bh : 0);
|
||||
wah = sh - bh;
|
||||
waw = sw;
|
||||
/* pixmap for everything */
|
||||
@ -273,7 +272,7 @@ main(int argc, char *argv[]) {
|
||||
break;
|
||||
default:
|
||||
for(stext[r] = '\0', p = stext + strlen(stext) - 1; p >= stext && *p == '\n'; *p-- = '\0');
|
||||
for(p = stext + strlen(stext) - 1; p >= stext && *p != '\n'; --p);
|
||||
for(; p >= stext && *p != '\n'; --p);
|
||||
if(p > stext)
|
||||
strncpy(stext, p + 1, sizeof stext);
|
||||
}
|
||||
|
8
tag.c
8
tag.c
@ -76,13 +76,13 @@ settags(Client *c, Client *trans) {
|
||||
unsigned int i, j;
|
||||
regmatch_t tmp;
|
||||
Bool matched = trans != NULL;
|
||||
XClassHint ch;
|
||||
XClassHint ch = { 0 };
|
||||
|
||||
if(matched) {
|
||||
if(matched)
|
||||
for(i = 0; i < ntags; i++)
|
||||
c->tags[i] = trans->tags[i];
|
||||
}
|
||||
else if(XGetClassHint(dpy, c->win, &ch)) {
|
||||
else {
|
||||
XGetClassHint(dpy, c->win, &ch);
|
||||
snprintf(prop, sizeof prop, "%s:%s:%s",
|
||||
ch.res_class ? ch.res_class : "",
|
||||
ch.res_name ? ch.res_name : "", c->name);
|
||||
|
9
view.c
9
view.c
@ -55,9 +55,8 @@ dofloat(void) {
|
||||
Client *c;
|
||||
|
||||
for(c = clients; c; c = c->next) {
|
||||
if(isvisible(c)) {
|
||||
if(isvisible(c))
|
||||
resize(c, True);
|
||||
}
|
||||
else
|
||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
||||
}
|
||||
@ -150,7 +149,7 @@ focusprev(Arg *arg) {
|
||||
void
|
||||
incnmaster(Arg *arg) {
|
||||
if((arrange == dofloat) || (nmaster + arg->i < 1)
|
||||
|| (wah / (nmaster + arg->i) <= 2 * BORDERPX))
|
||||
|| (wah / (nmaster + arg->i) <= 2 * BORDERPX))
|
||||
return;
|
||||
nmaster += arg->i;
|
||||
if(sel)
|
||||
@ -175,7 +174,7 @@ resizemaster(Arg *arg) {
|
||||
master = MASTER;
|
||||
else {
|
||||
if(waw * (master + arg->i) / 1000 >= waw - 2 * BORDERPX
|
||||
|| waw * (master + arg->i) / 1000 <= 2 * BORDERPX)
|
||||
|| waw * (master + arg->i) / 1000 <= 2 * BORDERPX)
|
||||
return;
|
||||
master += arg->i;
|
||||
}
|
||||
@ -207,7 +206,7 @@ restack(void) {
|
||||
|
||||
void
|
||||
togglefloat(Arg *arg) {
|
||||
if (!sel || arrange == dofloat)
|
||||
if(!sel || arrange == dofloat)
|
||||
return;
|
||||
sel->isfloat = !sel->isfloat;
|
||||
arrange();
|
||||
|
Reference in New Issue
Block a user