Compare commits
33 Commits
Author | SHA1 | Date | |
---|---|---|---|
5983c00b95 | |||
6651dd7fd9 | |||
acdea31916 | |||
10885d349a | |||
1c1d09f3e9 | |||
0384faeee5 | |||
6cca3999c8 | |||
69408d384d | |||
4aea423f06 | |||
6fc8a63041 | |||
2583a7c0d1 | |||
0ef6e3103c | |||
7c052b37c8 | |||
d9c475d7f4 | |||
c8e57332d1 | |||
c045459917 | |||
e0f64e63db | |||
dddd58a8cd | |||
010fd21b20 | |||
1802fad2f9 | |||
f833d109d1 | |||
7225c99903 | |||
36178933ed | |||
ad0da9a571 | |||
6646468125 | |||
fee8df6ccf | |||
8fa47ac679 | |||
b427a2c6cb | |||
14d05e7c72 | |||
a118a57fe3 | |||
02cea3b47e | |||
1c2d673ded | |||
c34df2c1b6 |
2
.hgtags
2
.hgtags
@ -15,3 +15,5 @@ f5f5cbf016a94b48a8fe9c47f0736e96d166d5d4 1.3
|
|||||||
728c9089b079721b43c3347124639a29baa22a97 1.5
|
728c9089b079721b43c3347124639a29baa22a97 1.5
|
||||||
ad3fa2d185426c51fd5deceae809770363f8d33c 1.6
|
ad3fa2d185426c51fd5deceae809770363f8d33c 1.6
|
||||||
4dbdb61c8b8ce21dee5c7050a6b103855964ed20 1.7
|
4dbdb61c8b8ce21dee5c7050a6b103855964ed20 1.7
|
||||||
|
d5ad819f2a66a40fa75dd2e44429f3bfc884d07b 1.7.1
|
||||||
|
c71952fa3c7ca848ec38a6923b5c6d0e18fff431 1.8
|
||||||
|
2
README
2
README
@ -37,7 +37,7 @@ like this in your .xinitrc:
|
|||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
echo `date` `uptime | sed 's/.*://; s/,//g'`
|
echo `date` `uptime | sed 's/.*,//'`
|
||||||
sleep 1
|
sleep 1
|
||||||
done | dwm
|
done | dwm
|
||||||
|
|
||||||
|
44
client.c
44
client.c
@ -1,5 +1,4 @@
|
|||||||
/*
|
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
||||||
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
@ -156,7 +155,6 @@ gravitate(Client *c, Bool invert) {
|
|||||||
dy = -(c->h);
|
dy = -(c->h);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (c->grav) {
|
switch (c->grav) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -177,7 +175,6 @@ gravitate(Client *c, Bool invert) {
|
|||||||
dx = -(c->w + c->border);
|
dx = -(c->w + c->border);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(invert) {
|
if(invert) {
|
||||||
dx = -dx;
|
dx = -dx;
|
||||||
dy = -dy;
|
dy = -dy;
|
||||||
@ -210,19 +207,16 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
c->w = c->tw = wa->width;
|
c->w = c->tw = wa->width;
|
||||||
c->h = wa->height;
|
c->h = wa->height;
|
||||||
c->th = bh;
|
c->th = bh;
|
||||||
|
|
||||||
c->border = 0;
|
c->border = 0;
|
||||||
updatesize(c);
|
updatesize(c);
|
||||||
|
if(c->x + c->w + 2 * BORDERPX > sw)
|
||||||
if(c->x + c->w + 2 > sw)
|
c->x = sw - c->w - 2 * BORDERPX;
|
||||||
c->x = sw - c->w - 2;
|
if(c->x < sx)
|
||||||
if(c->x < 0)
|
c->x = sx;
|
||||||
c->x = 0;
|
if(c->y + c->h + 2 * BORDERPX > sh)
|
||||||
if(c->y + c->h + 2 > sh)
|
c->y = sh - c->h - 2 * BORDERPX;
|
||||||
c->y = sh - c->h - 2;
|
|
||||||
if(c->h != sh && c->y < bh)
|
if(c->h != sh && c->y < bh)
|
||||||
c->y = bh;
|
c->y = bh;
|
||||||
|
|
||||||
c->proto = getproto(c->win);
|
c->proto = getproto(c->win);
|
||||||
XSelectInput(dpy, c->win,
|
XSelectInput(dpy, c->win,
|
||||||
StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
|
StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
|
||||||
@ -230,12 +224,10 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
twa.override_redirect = 1;
|
twa.override_redirect = 1;
|
||||||
twa.background_pixmap = ParentRelative;
|
twa.background_pixmap = ParentRelative;
|
||||||
twa.event_mask = ExposureMask | EnterWindowMask;
|
twa.event_mask = ExposureMask | EnterWindowMask;
|
||||||
|
|
||||||
c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
|
c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
|
||||||
0, DefaultDepth(dpy, screen), CopyFromParent,
|
0, DefaultDepth(dpy, screen), CopyFromParent,
|
||||||
DefaultVisual(dpy, screen),
|
DefaultVisual(dpy, screen),
|
||||||
CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
|
CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
|
||||||
|
|
||||||
grabbuttons(c, False);
|
grabbuttons(c, False);
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
settags(c, getclient(trans));
|
settags(c, getclient(trans));
|
||||||
@ -244,19 +236,17 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
|| (c->maxw && c->minw &&
|
|| (c->maxw && c->minw &&
|
||||||
c->maxw == c->minw && c->maxh == c->minh);
|
c->maxw == c->minw && c->maxh == c->minh);
|
||||||
resizetitle(c);
|
resizetitle(c);
|
||||||
|
|
||||||
if(clients)
|
if(clients)
|
||||||
clients->prev = c;
|
clients->prev = c;
|
||||||
c->next = clients;
|
c->next = clients;
|
||||||
c->snext = stack;
|
c->snext = stack;
|
||||||
stack = clients = c;
|
stack = clients = c;
|
||||||
|
|
||||||
ban(c);
|
ban(c);
|
||||||
XMapWindow(dpy, c->win);
|
XMapWindow(dpy, c->win);
|
||||||
XMapWindow(dpy, c->twin);
|
XMapWindow(dpy, c->twin);
|
||||||
if(isvisible(c))
|
if(isvisible(c))
|
||||||
focus(c);
|
focus(c);
|
||||||
arrange(NULL);
|
arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -283,17 +273,15 @@ resize(Client *c, Bool sizehints, Corner sticky) {
|
|||||||
c->x = right - c->w;
|
c->x = right - c->w;
|
||||||
if(sticky == BotLeft || sticky == BotRight)
|
if(sticky == BotLeft || sticky == BotRight)
|
||||||
c->y = bottom - c->h;
|
c->y = bottom - c->h;
|
||||||
|
|
||||||
/* offscreen appearance fixes */
|
/* offscreen appearance fixes */
|
||||||
if(c->x + c->w < 0)
|
if(c->x + c->w < sx)
|
||||||
c->x = 0;
|
c->x = sx;
|
||||||
if(c->y + c->h < bh)
|
if(c->y + c->h < bh)
|
||||||
c->y = bh;
|
c->y = bh;
|
||||||
if(c->x > sw)
|
if(c->x > sw)
|
||||||
c->x = sw - c->w;
|
c->x = sw - c->w;
|
||||||
if(c->y > sh)
|
if(c->y > sh)
|
||||||
c->y = sh - c->h;
|
c->y = sh - c->h;
|
||||||
|
|
||||||
resizetitle(c);
|
resizetitle(c);
|
||||||
wc.x = c->x;
|
wc.x = c->x;
|
||||||
wc.y = c->y;
|
wc.y = c->y;
|
||||||
@ -302,7 +290,7 @@ resize(Client *c, Bool sizehints, Corner sticky) {
|
|||||||
if(c->w == sw && c->h == sh)
|
if(c->w == sw && c->h == sh)
|
||||||
wc.border_width = 0;
|
wc.border_width = 0;
|
||||||
else
|
else
|
||||||
wc.border_width = 1;
|
wc.border_width = BORDERPX;
|
||||||
XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc);
|
XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc);
|
||||||
configure(c);
|
configure(c);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
@ -312,8 +300,8 @@ void
|
|||||||
resizetitle(Client *c) {
|
resizetitle(Client *c) {
|
||||||
c->tw = textw(c->name);
|
c->tw = textw(c->name);
|
||||||
if(c->tw > c->w)
|
if(c->tw > c->w)
|
||||||
c->tw = c->w + 2;
|
c->tw = c->w + 2 * BORDERPX;
|
||||||
c->tx = c->x + c->w - c->tw + 2;
|
c->tx = c->x + c->w - c->tw + 2 * BORDERPX;
|
||||||
c->ty = c->y;
|
c->ty = c->y;
|
||||||
if(isvisible(c))
|
if(isvisible(c))
|
||||||
XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th);
|
XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th);
|
||||||
@ -392,22 +380,18 @@ unmanage(Client *c) {
|
|||||||
/* The server grab construct avoids race conditions. */
|
/* The server grab construct avoids race conditions. */
|
||||||
XGrabServer(dpy);
|
XGrabServer(dpy);
|
||||||
XSetErrorHandler(xerrordummy);
|
XSetErrorHandler(xerrordummy);
|
||||||
|
|
||||||
detach(c);
|
detach(c);
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
if(sel == c) {
|
if(sel == c) {
|
||||||
for(nc = stack; nc && !isvisible(nc); nc = nc->snext);
|
for(nc = stack; nc && !isvisible(nc); nc = nc->snext);
|
||||||
focus(nc);
|
focus(nc);
|
||||||
}
|
}
|
||||||
|
|
||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||||
XDestroyWindow(dpy, c->twin);
|
XDestroyWindow(dpy, c->twin);
|
||||||
|
|
||||||
free(c->tags);
|
free(c->tags);
|
||||||
free(c);
|
free(c);
|
||||||
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
XSetErrorHandler(xerror);
|
XSetErrorHandler(xerror);
|
||||||
XUngrabServer(dpy);
|
XUngrabServer(dpy);
|
||||||
arrange(NULL);
|
arrange();
|
||||||
}
|
}
|
||||||
|
11
config.arg.h
11
config.arg.h
@ -1,5 +1,4 @@
|
|||||||
/*
|
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
||||||
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -18,7 +17,7 @@ const char *tags[] = { "dev", "work", "net", "fnord", NULL };
|
|||||||
#define STATUSBGCOLOR "#222222"
|
#define STATUSBGCOLOR "#222222"
|
||||||
#define STATUSFGCOLOR "#9999cc"
|
#define STATUSFGCOLOR "#9999cc"
|
||||||
|
|
||||||
#define MASTERW 60 /* percent */
|
#define MASTER 600 /* per thousand */
|
||||||
#define MODKEY Mod1Mask
|
#define MODKEY Mod1Mask
|
||||||
|
|
||||||
#define KEYS \
|
#define KEYS \
|
||||||
@ -34,8 +33,8 @@ static Key key[] = { \
|
|||||||
{ MODKEY, XK_j, focusnext, { 0 } }, \
|
{ MODKEY, XK_j, focusnext, { 0 } }, \
|
||||||
{ MODKEY, XK_k, focusprev, { 0 } }, \
|
{ MODKEY, XK_k, focusprev, { 0 } }, \
|
||||||
{ MODKEY, XK_Return, zoom, { 0 } }, \
|
{ MODKEY, XK_Return, zoom, { 0 } }, \
|
||||||
{ MODKEY, XK_g, resizecol, { .i = 20 } }, \
|
{ MODKEY, XK_g, resizecol, { .i = 15 } }, \
|
||||||
{ MODKEY, XK_s, resizecol, { .i = -20 } }, \
|
{ MODKEY, XK_s, resizecol, { .i = -15 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
|
{ MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
|
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \
|
{ MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \
|
||||||
@ -61,7 +60,7 @@ static Key key[] = { \
|
|||||||
#define RULES \
|
#define RULES \
|
||||||
static Rule rule[] = { \
|
static Rule rule[] = { \
|
||||||
/* class:instance:title regex tags regex isfloat */ \
|
/* class:instance:title regex tags regex isfloat */ \
|
||||||
{ "Firefox.*", "net", True}, \
|
{ "Firefox.*", "net", False}, \
|
||||||
{ "Gimp.*", NULL, True}, \
|
{ "Gimp.*", NULL, True}, \
|
||||||
{ "MPlayer.*", NULL, True}, \
|
{ "MPlayer.*", NULL, True}, \
|
||||||
{ "Acroread.*", NULL, True}, \
|
{ "Acroread.*", NULL, True}, \
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/*
|
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
||||||
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -18,7 +17,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", NULL };
|
|||||||
#define STATUSBGCOLOR "#dddddd"
|
#define STATUSBGCOLOR "#dddddd"
|
||||||
#define STATUSFGCOLOR "#222222"
|
#define STATUSFGCOLOR "#222222"
|
||||||
|
|
||||||
#define MASTERW 60 /* percent */
|
#define MASTER 600 /* per thousand */
|
||||||
#define MODKEY Mod1Mask
|
#define MODKEY Mod1Mask
|
||||||
|
|
||||||
#define KEYS \
|
#define KEYS \
|
||||||
@ -28,8 +27,8 @@ static Key key[] = { \
|
|||||||
{ MODKEY, XK_Tab, focusnext, { 0 } }, \
|
{ MODKEY, XK_Tab, focusnext, { 0 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \
|
{ MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \
|
||||||
{ MODKEY, XK_Return, zoom, { 0 } }, \
|
{ MODKEY, XK_Return, zoom, { 0 } }, \
|
||||||
{ MODKEY, XK_g, resizecol, { .i = 20 } }, \
|
{ MODKEY, XK_g, resizecol, { .i = 15 } }, \
|
||||||
{ MODKEY, XK_s, resizecol, { .i = -20 } }, \
|
{ MODKEY, XK_s, resizecol, { .i = -15 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
|
{ MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
|
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \
|
{ MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# dwm version
|
# dwm version
|
||||||
VERSION = 1.7.1
|
VERSION = 1.9
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
|
16
draw.c
16
draw.c
@ -1,5 +1,4 @@
|
|||||||
/*
|
/* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
||||||
* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
@ -30,21 +29,17 @@ drawtext(const char *text, unsigned long col[ColLast], Bool highlight) {
|
|||||||
|
|
||||||
XSetForeground(dpy, dc.gc, col[ColBG]);
|
XSetForeground(dpy, dc.gc, col[ColBG]);
|
||||||
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
||||||
|
|
||||||
if(!text)
|
if(!text)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
w = 0;
|
w = 0;
|
||||||
olen = len = strlen(text);
|
olen = len = strlen(text);
|
||||||
if(len >= sizeof(buf))
|
if(len >= sizeof(buf))
|
||||||
len = sizeof(buf) - 1;
|
len = sizeof(buf) - 1;
|
||||||
memcpy(buf, text, len);
|
memcpy(buf, text, len);
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
|
|
||||||
h = dc.font.ascent + dc.font.descent;
|
h = dc.font.ascent + dc.font.descent;
|
||||||
y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent;
|
y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent;
|
||||||
x = dc.x + (h / 2);
|
x = dc.x + (h / 2);
|
||||||
|
|
||||||
/* shorten text if necessary */
|
/* shorten text if necessary */
|
||||||
while(len && (w = textnw(buf, len)) > dc.w - h)
|
while(len && (w = textnw(buf, len)) > dc.w - h)
|
||||||
buf[--len] = 0;
|
buf[--len] = 0;
|
||||||
@ -56,7 +51,6 @@ drawtext(const char *text, unsigned long col[ColLast], Bool highlight) {
|
|||||||
if(len > 3)
|
if(len > 3)
|
||||||
buf[len - 3] = '.';
|
buf[len - 3] = '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(w > dc.w)
|
if(w > dc.w)
|
||||||
return; /* too long */
|
return; /* too long */
|
||||||
gcv.foreground = col[ColFG];
|
gcv.foreground = col[ColFG];
|
||||||
@ -72,7 +66,7 @@ drawtext(const char *text, unsigned long col[ColLast], Bool highlight) {
|
|||||||
if(highlight) {
|
if(highlight) {
|
||||||
r.x = dc.x + 2;
|
r.x = dc.x + 2;
|
||||||
r.y = dc.y + 2;
|
r.y = dc.y + 2;
|
||||||
r.width = r.height = 3;
|
r.width = r.height = (h + 2) / 4;
|
||||||
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,7 +87,6 @@ drawstatus(void) {
|
|||||||
int i, x;
|
int i, x;
|
||||||
|
|
||||||
dc.x = dc.y = 0;
|
dc.x = dc.y = 0;
|
||||||
|
|
||||||
for(i = 0; i < ntags; i++) {
|
for(i = 0; i < ntags; i++) {
|
||||||
dc.w = textw(tags[i]);
|
dc.w = textw(tags[i]);
|
||||||
if(seltag[i])
|
if(seltag[i])
|
||||||
@ -102,10 +95,8 @@ drawstatus(void) {
|
|||||||
drawtext(tags[i], dc.norm, sel && sel->tags[i]);
|
drawtext(tags[i], dc.norm, sel && sel->tags[i]);
|
||||||
dc.x += dc.w;
|
dc.x += dc.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc.w = bmw;
|
dc.w = bmw;
|
||||||
drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False);
|
drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False);
|
||||||
|
|
||||||
x = dc.x + dc.w;
|
x = dc.x + dc.w;
|
||||||
dc.w = textw(stext);
|
dc.w = textw(stext);
|
||||||
dc.x = bx + bw - dc.w;
|
dc.x = bx + bw - dc.w;
|
||||||
@ -114,7 +105,6 @@ drawstatus(void) {
|
|||||||
dc.w = bw - x;
|
dc.w = bw - x;
|
||||||
}
|
}
|
||||||
drawtext(stext, dc.status, False);
|
drawtext(stext, dc.status, False);
|
||||||
|
|
||||||
if((dc.w = dc.x - x) > bh) {
|
if((dc.w = dc.x - x) > bh) {
|
||||||
dc.x = x;
|
dc.x = x;
|
||||||
if(sel)
|
if(sel)
|
||||||
@ -134,7 +124,6 @@ drawtitle(Client *c) {
|
|||||||
XSetWindowBorder(dpy, c->win, dc.sel[ColBG]);
|
XSetWindowBorder(dpy, c->win, dc.sel[ColBG]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
XSetWindowBorder(dpy, c->win, dc.norm[ColBG]);
|
XSetWindowBorder(dpy, c->win, dc.norm[ColBG]);
|
||||||
XMapWindow(dpy, c->twin);
|
XMapWindow(dpy, c->twin);
|
||||||
dc.x = dc.y = 0;
|
dc.x = dc.y = 0;
|
||||||
@ -177,7 +166,6 @@ setfont(const char *fontstr) {
|
|||||||
XFontSetExtents *font_extents;
|
XFontSetExtents *font_extents;
|
||||||
XFontStruct **xfonts;
|
XFontStruct **xfonts;
|
||||||
char **font_names;
|
char **font_names;
|
||||||
|
|
||||||
dc.font.ascent = dc.font.descent = 0;
|
dc.font.ascent = dc.font.descent = 0;
|
||||||
font_extents = XExtentsOfFontSet(dc.font.set);
|
font_extents = XExtentsOfFontSet(dc.font.set);
|
||||||
n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names);
|
n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names);
|
||||||
|
18
dwm.1
18
dwm.1
@ -9,9 +9,9 @@ dwm is a dynamic window manager for X. It manages windows in tiling and
|
|||||||
floating modes. Either mode can be applied dynamically, optimizing the
|
floating modes. Either mode can be applied dynamically, optimizing the
|
||||||
environment for the application in use and the task performed.
|
environment for the application in use and the task performed.
|
||||||
.P
|
.P
|
||||||
In tiling mode windows are managed in a master and stacking column. The master
|
In tiling mode windows are managed in a master and stacking area. The master
|
||||||
column contains the window which currently needs most attention, whereas the
|
area contains the window which currently needs most attention, whereas the
|
||||||
stacking column contains all other windows. In floating mode windows can be
|
stacking area contains all other windows. In floating mode windows can be
|
||||||
resized and moved freely. Dialog windows are always managed floating,
|
resized and moved freely. Dialog windows are always managed floating,
|
||||||
regardless of the mode selected.
|
regardless of the mode selected.
|
||||||
.P
|
.P
|
||||||
@ -37,7 +37,7 @@ is read and displayed in the status text area.
|
|||||||
.TP
|
.TP
|
||||||
.B Button1
|
.B Button1
|
||||||
click on a tag label to display all windows with that tag, click on the mode
|
click on a tag label to display all windows with that tag, click on the mode
|
||||||
label toggles between tiled and floating mode.
|
label toggles between tiling and floating mode.
|
||||||
.TP
|
.TP
|
||||||
.B Button3
|
.B Button3
|
||||||
click on a tag label adds/removes all windows with that tag to/from the view.
|
click on a tag label adds/removes all windows with that tag to/from the view.
|
||||||
@ -60,13 +60,13 @@ Focus next window.
|
|||||||
Focus previous window.
|
Focus previous window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Return
|
.B Mod1-Return
|
||||||
Zooms/cycles current window to/from master column (tiling mode), toggles maximization current window (floating mode).
|
Zooms/cycles current window to/from master area (tiling mode), toggles maximization current window (floating mode).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-g
|
.B Mod1-g
|
||||||
Grow current column (tiling mode only).
|
Grow current area (tiling mode only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-s
|
.B Mod1-s
|
||||||
Shrink current column (tiling mode only).
|
Shrink current area (tiling mode only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Shift-[1..n]
|
.B Mod1-Shift-[1..n]
|
||||||
Apply
|
Apply
|
||||||
@ -82,7 +82,7 @@ tag to/from current window.
|
|||||||
Close focused window.
|
Close focused window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-space
|
.B Mod1-space
|
||||||
Toggle between tiled and floating mode (affects all windows).
|
Toggle between tiling and floating mode (affects all windows).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-[1..n]
|
.B Mod1-[1..n]
|
||||||
View all windows with
|
View all windows with
|
||||||
@ -105,7 +105,7 @@ Quit dwm.
|
|||||||
Move current window while dragging (floating mode only).
|
Move current window while dragging (floating mode only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Button2
|
.B Mod1-Button2
|
||||||
Zoom current window to the master column (tiling mode only).
|
Zoom current window to the master area (tiling mode only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Button3
|
.B Mod1-Button3
|
||||||
Resize current window while dragging (floating mode only).
|
Resize current window while dragging (floating mode only).
|
||||||
|
19
dwm.h
19
dwm.h
@ -1,5 +1,4 @@
|
|||||||
/*
|
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
||||||
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*
|
*
|
||||||
* dynamic window manager is designed like any other X client as well. It is
|
* dynamic window manager is designed like any other X client as well. It is
|
||||||
@ -38,6 +37,8 @@
|
|||||||
/* mask shorthands, used in event.c and client.c */
|
/* mask shorthands, used in event.c and client.c */
|
||||||
#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
|
#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
|
||||||
#define MOUSEMASK (BUTTONMASK | PointerMotionMask)
|
#define MOUSEMASK (BUTTONMASK | PointerMotionMask)
|
||||||
|
/* other stuff used in different places */
|
||||||
|
#define BORDERPX 1
|
||||||
#define PROTODELWIN 1
|
#define PROTODELWIN 1
|
||||||
|
|
||||||
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
||||||
@ -95,10 +96,10 @@ struct Client {
|
|||||||
extern const char *tags[]; /* all tags */
|
extern const char *tags[]; /* all tags */
|
||||||
extern char stext[1024]; /* status text */
|
extern char stext[1024]; /* status text */
|
||||||
extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */
|
extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */
|
||||||
extern int mw, screen, sx, sy, sw, sh; /* screen geometry, master width */
|
extern int screen, sx, sy, sw, sh; /* screen geometry */
|
||||||
extern unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */
|
extern unsigned int master, ntags, numlockmask; /* master percent, number of tags, dynamic lock mask */
|
||||||
extern void (*handler[LASTEvent])(XEvent *); /* event handler */
|
extern void (*handler[LASTEvent])(XEvent *); /* event handler */
|
||||||
extern void (*arrange)(Arg *); /* arrange function, indicates mode */
|
extern void (*arrange)(void); /* arrange function, indicates mode */
|
||||||
extern Atom wmatom[WMLast], netatom[NetLast];
|
extern Atom wmatom[WMLast], netatom[NetLast];
|
||||||
extern Bool running, issel, *seltag; /* seltag is array of Bool */
|
extern Bool running, issel, *seltag; /* seltag is array of Bool */
|
||||||
extern Client *clients, *sel, *stack; /* global client list and stack */
|
extern Client *clients, *sel, *stack; /* global client list and stack */
|
||||||
@ -156,15 +157,15 @@ extern void spawn(Arg *arg); /* forks a new subprocess with to arg's cmd */
|
|||||||
|
|
||||||
/* view.c */
|
/* view.c */
|
||||||
extern void detach(Client *c); /* detaches c from global client list */
|
extern void detach(Client *c); /* detaches c from global client list */
|
||||||
extern void dofloat(Arg *arg); /* arranges all windows floating, arg is ignored */
|
extern void dofloat(void); /* arranges all windows floating */
|
||||||
extern void dotile(Arg *arg); /* arranges all windows, arg is ignored */
|
extern void dotile(void); /* arranges all windows tiled */
|
||||||
extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
|
extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
|
||||||
extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */
|
extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */
|
||||||
extern Bool isvisible(Client *c); /* returns True if client is visible */
|
extern Bool isvisible(Client *c); /* returns True if client is visible */
|
||||||
extern void resizecol(Arg *arg); /* resizes the master width with arg's index value */
|
extern void resizecol(Arg *arg); /* resizes the master percent with arg's index value */
|
||||||
extern void restack(void); /* restores z layers of all clients */
|
extern void restack(void); /* restores z layers of all clients */
|
||||||
extern void togglemode(Arg *arg); /* toggles global arrange function (dotile/dofloat) */
|
extern void togglemode(Arg *arg); /* toggles global arrange function (dotile/dofloat) */
|
||||||
extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */
|
extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */
|
||||||
extern void view(Arg *arg); /* views the tag with arg's index */
|
extern void view(Arg *arg); /* views the tag with arg's index */
|
||||||
extern void viewall(Arg *arg); /* views all tags, arg is ignored */
|
extern void viewall(Arg *arg); /* views all tags, arg is ignored */
|
||||||
extern void zoom(Arg *arg); /* zooms the focused client to master column, arg is ignored */
|
extern void zoom(Arg *arg); /* zooms the focused client to master area, arg is ignored */
|
||||||
|
20
event.c
20
event.c
@ -1,5 +1,4 @@
|
|||||||
/*
|
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
||||||
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
@ -123,11 +122,9 @@ buttonpress(XEvent *e) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ev->x < x + bmw) {
|
if((ev->x < x + bmw) && (ev->button == Button1))
|
||||||
if(ev->button == Button1)
|
|
||||||
togglemode(NULL);
|
togglemode(NULL);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if((c = getclient(ev->window))) {
|
else if((c = getclient(ev->window))) {
|
||||||
focus(c);
|
focus(c);
|
||||||
if(CLEANMASK(ev->state) != MODKEY)
|
if(CLEANMASK(ev->state) != MODKEY)
|
||||||
@ -176,10 +173,13 @@ configurerequest(XEvent *e) {
|
|||||||
else
|
else
|
||||||
configure(c);
|
configure(c);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
if(c->isfloat)
|
if(c->isfloat) {
|
||||||
resize(c, False, TopLeft);
|
resize(c, False, TopLeft);
|
||||||
|
if(!isvisible(c))
|
||||||
|
ban(c);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
arrange(NULL);
|
arrange();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wc.x = ev->x;
|
wc.x = ev->x;
|
||||||
@ -210,7 +210,6 @@ enternotify(XEvent *e) {
|
|||||||
|
|
||||||
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
|
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(((c = getclient(ev->window)) || (c = getctitle(ev->window))) && isvisible(c))
|
if(((c = getclient(ev->window)) || (c = getctitle(ev->window))) && isvisible(c))
|
||||||
focus(c);
|
focus(c);
|
||||||
else if(ev->window == root) {
|
else if(ev->window == root) {
|
||||||
@ -278,13 +277,11 @@ maprequest(XEvent *e) {
|
|||||||
|
|
||||||
if(!XGetWindowAttributes(dpy, ev->window, &wa))
|
if(!XGetWindowAttributes(dpy, ev->window, &wa))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(wa.override_redirect) {
|
if(wa.override_redirect) {
|
||||||
XSelectInput(dpy, ev->window,
|
XSelectInput(dpy, ev->window,
|
||||||
(StructureNotifyMask | PropertyChangeMask));
|
(StructureNotifyMask | PropertyChangeMask));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!getclient(ev->window))
|
if(!getclient(ev->window))
|
||||||
manage(ev->window, &wa);
|
manage(ev->window, &wa);
|
||||||
}
|
}
|
||||||
@ -297,7 +294,6 @@ propertynotify(XEvent *e) {
|
|||||||
|
|
||||||
if(ev->state == PropertyDelete)
|
if(ev->state == PropertyDelete)
|
||||||
return; /* ignore */
|
return; /* ignore */
|
||||||
|
|
||||||
if((c = getclient(ev->window))) {
|
if((c = getclient(ev->window))) {
|
||||||
if(ev->atom == wmatom[WMProtocols]) {
|
if(ev->atom == wmatom[WMProtocols]) {
|
||||||
c->proto = getproto(c->win);
|
c->proto = getproto(c->win);
|
||||||
@ -308,7 +304,7 @@ propertynotify(XEvent *e) {
|
|||||||
case XA_WM_TRANSIENT_FOR:
|
case XA_WM_TRANSIENT_FOR:
|
||||||
XGetTransientForHint(dpy, c->win, &trans);
|
XGetTransientForHint(dpy, c->win, &trans);
|
||||||
if(!c->isfloat && (c->isfloat = (trans != 0)))
|
if(!c->isfloat && (c->isfloat = (trans != 0)))
|
||||||
arrange(NULL);
|
arrange();
|
||||||
break;
|
break;
|
||||||
case XA_WM_NORMAL_HINTS:
|
case XA_WM_NORMAL_HINTS:
|
||||||
updatesize(c);
|
updatesize(c);
|
||||||
|
38
main.c
38
main.c
@ -1,5 +1,4 @@
|
|||||||
/*
|
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
||||||
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -19,8 +18,8 @@
|
|||||||
|
|
||||||
char stext[1024];
|
char stext[1024];
|
||||||
Bool *seltag;
|
Bool *seltag;
|
||||||
int bx, by, bw, bh, bmw, mw, screen, sx, sy, sw, sh;
|
int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh;
|
||||||
unsigned int ntags, numlockmask;
|
unsigned int master, ntags, numlockmask;
|
||||||
Atom wmatom[WMLast], netatom[NetLast];
|
Atom wmatom[WMLast], netatom[NetLast];
|
||||||
Bool running = True;
|
Bool running = True;
|
||||||
Bool issel = True;
|
Bool issel = True;
|
||||||
@ -93,12 +92,11 @@ setup(void) {
|
|||||||
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
|
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
|
||||||
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
|
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
|
||||||
PropModeReplace, (unsigned char *) netatom, NetLast);
|
PropModeReplace, (unsigned char *) netatom, NetLast);
|
||||||
|
|
||||||
/* init cursors */
|
/* init cursors */
|
||||||
cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
|
cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
|
||||||
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
|
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
|
||||||
cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
|
cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
|
||||||
|
/* init modifier map */
|
||||||
modmap = XGetModifierMapping(dpy);
|
modmap = XGetModifierMapping(dpy);
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
for (j = 0; j < modmap->max_keypermod; j++) {
|
for (j = 0; j < modmap->max_keypermod; j++) {
|
||||||
@ -107,19 +105,16 @@ setup(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
XFree(modmap);
|
XFree(modmap);
|
||||||
|
/* select for events */
|
||||||
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
||||||
| EnterWindowMask | LeaveWindowMask;
|
| EnterWindowMask | LeaveWindowMask;
|
||||||
wa.cursor = cursor[CurNormal];
|
wa.cursor = cursor[CurNormal];
|
||||||
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
|
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
|
||||||
|
|
||||||
grabkeys();
|
grabkeys();
|
||||||
initrregs();
|
initrregs();
|
||||||
|
|
||||||
for(ntags = 0; tags[ntags]; ntags++);
|
for(ntags = 0; tags[ntags]; ntags++);
|
||||||
seltag = emallocz(sizeof(Bool) * ntags);
|
seltag = emallocz(sizeof(Bool) * ntags);
|
||||||
seltag[0] = True;
|
seltag[0] = True;
|
||||||
|
|
||||||
/* style */
|
/* style */
|
||||||
dc.norm[ColBG] = getcolor(NORMBGCOLOR);
|
dc.norm[ColBG] = getcolor(NORMBGCOLOR);
|
||||||
dc.norm[ColFG] = getcolor(NORMFGCOLOR);
|
dc.norm[ColFG] = getcolor(NORMFGCOLOR);
|
||||||
@ -128,13 +123,13 @@ setup(void) {
|
|||||||
dc.status[ColBG] = getcolor(STATUSBGCOLOR);
|
dc.status[ColBG] = getcolor(STATUSBGCOLOR);
|
||||||
dc.status[ColFG] = getcolor(STATUSFGCOLOR);
|
dc.status[ColFG] = getcolor(STATUSFGCOLOR);
|
||||||
setfont(FONT);
|
setfont(FONT);
|
||||||
|
/* geometry */
|
||||||
bmw = textw(FLOATSYMBOL) > textw(TILESYMBOL) ? textw(FLOATSYMBOL) : textw(TILESYMBOL);
|
bmw = textw(TILESYMBOL) > textw(FLOATSYMBOL) ? textw(TILESYMBOL) : textw(FLOATSYMBOL);
|
||||||
sx = sy = 0;
|
sx = sy = 0;
|
||||||
sw = DisplayWidth(dpy, screen);
|
sw = DisplayWidth(dpy, screen);
|
||||||
sh = DisplayHeight(dpy, screen);
|
sh = DisplayHeight(dpy, screen);
|
||||||
mw = (sw * MASTERW) / 100;
|
master = MASTER;
|
||||||
|
/* bar */
|
||||||
bx = by = 0;
|
bx = by = 0;
|
||||||
bw = sw;
|
bw = sw;
|
||||||
dc.h = bh = dc.font.height + 2;
|
dc.h = bh = dc.font.height + 2;
|
||||||
@ -146,13 +141,13 @@ setup(void) {
|
|||||||
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
||||||
XDefineCursor(dpy, barwin, cursor[CurNormal]);
|
XDefineCursor(dpy, barwin, cursor[CurNormal]);
|
||||||
XMapRaised(dpy, barwin);
|
XMapRaised(dpy, barwin);
|
||||||
|
strcpy(stext, "dwm-"VERSION);
|
||||||
|
/* pixmap for everything */
|
||||||
dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
|
dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
|
||||||
dc.gc = XCreateGC(dpy, root, 0, 0);
|
dc.gc = XCreateGC(dpy, root, 0, 0);
|
||||||
XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
|
XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
|
/* multihead support */
|
||||||
issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
|
issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
|
||||||
strcpy(stext, "dwm-"VERSION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -204,8 +199,7 @@ quit(Arg *arg) {
|
|||||||
readin = running = False;
|
readin = running = False;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* There's no way to check accesses to destroyed windows, thus those cases are
|
||||||
* There's no way to check accesses to destroyed windows, thus those cases are
|
|
||||||
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
|
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
|
||||||
* default error handler, which may call exit.
|
* default error handler, which may call exit.
|
||||||
*/
|
*/
|
||||||
@ -236,21 +230,17 @@ main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
else if(argc != 1)
|
else if(argc != 1)
|
||||||
eprint("usage: dwm [-v]\n");
|
eprint("usage: dwm [-v]\n");
|
||||||
|
|
||||||
dpy = XOpenDisplay(0);
|
dpy = XOpenDisplay(0);
|
||||||
if(!dpy)
|
if(!dpy)
|
||||||
eprint("dwm: cannot open display\n");
|
eprint("dwm: cannot open display\n");
|
||||||
|
|
||||||
xfd = ConnectionNumber(dpy);
|
xfd = ConnectionNumber(dpy);
|
||||||
screen = DefaultScreen(dpy);
|
screen = DefaultScreen(dpy);
|
||||||
root = RootWindow(dpy, screen);
|
root = RootWindow(dpy, screen);
|
||||||
|
|
||||||
otherwm = False;
|
otherwm = False;
|
||||||
XSetErrorHandler(xerrorstart);
|
XSetErrorHandler(xerrorstart);
|
||||||
/* this causes an error if some other window manager is running */
|
/* this causes an error if some other window manager is running */
|
||||||
XSelectInput(dpy, root, SubstructureRedirectMask);
|
XSelectInput(dpy, root, SubstructureRedirectMask);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
||||||
if(otherwm)
|
if(otherwm)
|
||||||
eprint("dwm: another window manager is already running\n");
|
eprint("dwm: another window manager is already running\n");
|
||||||
|
|
||||||
@ -258,7 +248,6 @@ main(int argc, char *argv[]) {
|
|||||||
XSetErrorHandler(NULL);
|
XSetErrorHandler(NULL);
|
||||||
xerrorxlib = XSetErrorHandler(xerror);
|
xerrorxlib = XSetErrorHandler(xerror);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
drawstatus();
|
drawstatus();
|
||||||
scan();
|
scan();
|
||||||
@ -291,6 +280,5 @@ main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
cleanup();
|
cleanup();
|
||||||
XCloseDisplay(dpy);
|
XCloseDisplay(dpy);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
10
tag.c
10
tag.c
@ -1,5 +1,4 @@
|
|||||||
/*
|
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
||||||
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
@ -53,7 +52,6 @@ initrregs(void) {
|
|||||||
return;
|
return;
|
||||||
len = sizeof(rule) / sizeof(rule[0]);
|
len = sizeof(rule) / sizeof(rule[0]);
|
||||||
rreg = emallocz(len * sizeof(RReg));
|
rreg = emallocz(len * sizeof(RReg));
|
||||||
|
|
||||||
for(i = 0; i < len; i++) {
|
for(i = 0; i < len; i++) {
|
||||||
if(rule[i].clpattern) {
|
if(rule[i].clpattern) {
|
||||||
reg = emallocz(sizeof(regex_t));
|
reg = emallocz(sizeof(regex_t));
|
||||||
@ -115,12 +113,11 @@ tag(Arg *arg) {
|
|||||||
|
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(i = 0; i < ntags; i++)
|
for(i = 0; i < ntags; i++)
|
||||||
sel->tags[i] = False;
|
sel->tags[i] = False;
|
||||||
sel->tags[arg->i] = True;
|
sel->tags[arg->i] = True;
|
||||||
sel->weight = arg->i;
|
sel->weight = arg->i;
|
||||||
arrange(NULL);
|
arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -129,11 +126,10 @@ toggletag(Arg *arg) {
|
|||||||
|
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sel->tags[arg->i] = !sel->tags[arg->i];
|
sel->tags[arg->i] = !sel->tags[arg->i];
|
||||||
for(i = 0; i < ntags && !sel->tags[i]; i++);
|
for(i = 0; i < ntags && !sel->tags[i]; i++);
|
||||||
if(i == ntags)
|
if(i == ntags)
|
||||||
sel->tags[arg->i] = True;
|
sel->tags[arg->i] = True;
|
||||||
sel->weight = (i == ntags) ? arg->i : i;
|
sel->weight = (i == ntags) ? arg->i : i;
|
||||||
arrange(NULL);
|
arrange();
|
||||||
}
|
}
|
||||||
|
5
util.c
5
util.c
@ -1,5 +1,4 @@
|
|||||||
/*
|
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
||||||
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
@ -33,6 +32,7 @@ eprint(const char *errstr, ...) {
|
|||||||
void *
|
void *
|
||||||
erealloc(void *ptr, unsigned int size) {
|
erealloc(void *ptr, unsigned int size) {
|
||||||
void *res = realloc(ptr, size);
|
void *res = realloc(ptr, size);
|
||||||
|
|
||||||
if(!res)
|
if(!res)
|
||||||
eprint("fatal: could not malloc() %u bytes\n", size);
|
eprint("fatal: could not malloc() %u bytes\n", size);
|
||||||
return res;
|
return res;
|
||||||
@ -44,7 +44,6 @@ spawn(Arg *arg) {
|
|||||||
|
|
||||||
if(!shell && !(shell = getenv("SHELL")))
|
if(!shell && !(shell = getenv("SHELL")))
|
||||||
shell = "/bin/sh";
|
shell = "/bin/sh";
|
||||||
|
|
||||||
if(!arg->cmd)
|
if(!arg->cmd)
|
||||||
return;
|
return;
|
||||||
/* The double-fork construct avoids zombie processes and keeps the code
|
/* The double-fork construct avoids zombie processes and keeps the code
|
||||||
|
103
view.c
103
view.c
@ -1,5 +1,4 @@
|
|||||||
/*
|
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
||||||
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
@ -43,14 +42,14 @@ reorder(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
togglemax(Client *c)
|
togglemax(Client *c) {
|
||||||
{
|
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
if((c->ismax = !c->ismax)) {
|
if((c->ismax = !c->ismax)) {
|
||||||
c->rx = c->x; c->x = sx;
|
c->rx = c->x; c->x = sx;
|
||||||
c->ry = c->y; c->y = bh;
|
c->ry = c->y; c->y = bh;
|
||||||
c->rw = c->w; c->w = sw;
|
c->rw = c->w; c->w = sw - 2 * BORDERPX;
|
||||||
c->rh = c->h; c->h = sh - bh - 2;
|
c->rh = c->h; c->h = sh - bh - 2 * BORDERPX;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c->x = c->rx;
|
c->x = c->rx;
|
||||||
@ -64,7 +63,7 @@ togglemax(Client *c)
|
|||||||
|
|
||||||
/* extern */
|
/* extern */
|
||||||
|
|
||||||
void (*arrange)(Arg *) = DEFMODE;
|
void (*arrange)(void) = DEFMODE;
|
||||||
|
|
||||||
void
|
void
|
||||||
detach(Client *c) {
|
detach(Client *c) {
|
||||||
@ -78,7 +77,7 @@ detach(Client *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dofloat(Arg *arg) {
|
dofloat(void) {
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(c = clients; c; c = c->next) {
|
for(c = clients; c; c = c->next) {
|
||||||
@ -96,59 +95,54 @@ dofloat(Arg *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dotile(Arg *arg) {
|
dotile(void) {
|
||||||
int h, i, n, w;
|
unsigned int i, n, mpx, stackw, stackh, th;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
w = sw - mw;
|
|
||||||
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
|
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
|
||||||
n++;
|
n++;
|
||||||
|
mpx = (sw * master) / 1000;
|
||||||
|
stackw = sw - mpx;
|
||||||
|
stackh = sh - bh;
|
||||||
|
th = stackh;
|
||||||
if(n > 1)
|
if(n > 1)
|
||||||
h = (sh - bh) / (n - 1);
|
th /= (n - 1);
|
||||||
else
|
|
||||||
h = sh - bh;
|
|
||||||
|
|
||||||
for(i = 0, c = clients; c; c = c->next) {
|
for(i = 0, c = clients; c; c = c->next, i++)
|
||||||
if(isvisible(c)) {
|
if(isvisible(c)) {
|
||||||
if(c->isfloat) {
|
if(c->isfloat) {
|
||||||
resize(c, True, TopLeft);
|
resize(c, True, TopLeft);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
if(n == 1) {
|
|
||||||
c->x = sx;
|
c->x = sx;
|
||||||
c->y = sy + bh;
|
c->y = sy + bh;
|
||||||
c->w = sw - 2;
|
if(n == 1) { /* only 1 window */
|
||||||
c->h = sh - 2 - bh;
|
c->w = sw - 2 * BORDERPX;
|
||||||
|
c->h = sh - 2 * BORDERPX - bh;
|
||||||
}
|
}
|
||||||
else if(i == 0) {
|
else if(i == 0) { /* master window */
|
||||||
c->x = sx;
|
c->w = mpx - 2 * BORDERPX;
|
||||||
c->y = sy + bh;
|
c->h = sh - bh - 2 * BORDERPX;
|
||||||
c->w = mw - 2;
|
|
||||||
c->h = sh - 2 - bh;
|
|
||||||
}
|
}
|
||||||
else if(h > bh) {
|
else { /* tile window */
|
||||||
c->x = sx + mw;
|
c->x += mpx;
|
||||||
c->y = sy + (i - 1) * h + bh;
|
c->w = stackw - 2 * BORDERPX;
|
||||||
c->w = w - 2;
|
if(th > bh) {
|
||||||
|
c->y = sy + (i - 1) * th + bh;
|
||||||
if(i + 1 == n)
|
if(i + 1 == n)
|
||||||
c->h = sh - c->y - 2;
|
c->h = sh - c->y - 2 * BORDERPX;
|
||||||
else
|
else
|
||||||
c->h = h - 2;
|
c->h = th - 2 * BORDERPX;
|
||||||
}
|
}
|
||||||
else { /* fallback if h < bh */
|
else /* fallback if th < bh */
|
||||||
c->x = sx + mw;
|
c->h = stackh - 2 * BORDERPX;
|
||||||
c->y = sy + bh;
|
|
||||||
c->w = w - 2;
|
|
||||||
c->h = sh - 2 - bh;
|
|
||||||
}
|
}
|
||||||
resize(c, False, TopLeft);
|
resize(c, False, TopLeft);
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ban(c);
|
ban(c);
|
||||||
}
|
|
||||||
if(!sel || !isvisible(sel)) {
|
if(!sel || !isvisible(sel)) {
|
||||||
for(c = stack; c && !isvisible(c); c = c->snext);
|
for(c = stack; c && !isvisible(c); c = c->snext);
|
||||||
focus(c);
|
focus(c);
|
||||||
@ -162,7 +156,6 @@ focusnext(Arg *arg) {
|
|||||||
|
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!(c = getnext(sel->next)))
|
if(!(c = getnext(sel->next)))
|
||||||
c = getnext(clients);
|
c = getnext(clients);
|
||||||
if(c) {
|
if(c) {
|
||||||
@ -177,7 +170,6 @@ focusprev(Arg *arg) {
|
|||||||
|
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!(c = getprev(sel->prev))) {
|
if(!(c = getprev(sel->prev))) {
|
||||||
for(c = clients; c && c->next; c = c->next);
|
for(c = clients; c && c->next; c = c->next);
|
||||||
c = getprev(c);
|
c = getprev(c);
|
||||||
@ -208,18 +200,17 @@ resizecol(Arg *arg) {
|
|||||||
n++;
|
n++;
|
||||||
if(!sel || sel->isfloat || n < 2 || (arrange == dofloat))
|
if(!sel || sel->isfloat || n < 2 || (arrange == dofloat))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(sel == getnext(clients)) {
|
if(sel == getnext(clients)) {
|
||||||
if(mw + arg->i > sw - 100 || mw + arg->i < 100)
|
if(master + arg->i > 950 || master + arg->i < 50)
|
||||||
return;
|
return;
|
||||||
mw += arg->i;
|
master += arg->i;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(mw - arg->i > sw - 100 || mw - arg->i < 100)
|
if(master - arg->i > 950 || master - arg->i < 50)
|
||||||
return;
|
return;
|
||||||
mw -= arg->i;
|
master -= arg->i;
|
||||||
}
|
}
|
||||||
arrange(NULL);
|
arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -235,11 +226,18 @@ restack(void) {
|
|||||||
XRaiseWindow(dpy, sel->win);
|
XRaiseWindow(dpy, sel->win);
|
||||||
XRaiseWindow(dpy, sel->twin);
|
XRaiseWindow(dpy, sel->twin);
|
||||||
}
|
}
|
||||||
if(arrange != dofloat)
|
if(arrange != dofloat) {
|
||||||
|
if(!sel->isfloat) {
|
||||||
|
XLowerWindow(dpy, sel->twin);
|
||||||
|
XLowerWindow(dpy, sel->win);
|
||||||
|
}
|
||||||
for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
|
for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
|
||||||
|
if(c == sel)
|
||||||
|
continue;
|
||||||
XLowerWindow(dpy, c->twin);
|
XLowerWindow(dpy, c->twin);
|
||||||
XLowerWindow(dpy, c->win);
|
XLowerWindow(dpy, c->win);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
drawall();
|
drawall();
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||||
@ -249,7 +247,7 @@ void
|
|||||||
togglemode(Arg *arg) {
|
togglemode(Arg *arg) {
|
||||||
arrange = (arrange == dofloat) ? dotile : dofloat;
|
arrange = (arrange == dofloat) ? dotile : dofloat;
|
||||||
if(sel)
|
if(sel)
|
||||||
arrange(NULL);
|
arrange();
|
||||||
else
|
else
|
||||||
drawstatus();
|
drawstatus();
|
||||||
}
|
}
|
||||||
@ -263,7 +261,7 @@ toggleview(Arg *arg) {
|
|||||||
if(i == ntags)
|
if(i == ntags)
|
||||||
seltag[arg->i] = True; /* cannot toggle last view */
|
seltag[arg->i] = True; /* cannot toggle last view */
|
||||||
reorder();
|
reorder();
|
||||||
arrange(NULL);
|
arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -274,7 +272,7 @@ view(Arg *arg) {
|
|||||||
seltag[i] = False;
|
seltag[i] = False;
|
||||||
seltag[arg->i] = True;
|
seltag[arg->i] = True;
|
||||||
reorder();
|
reorder();
|
||||||
arrange(NULL);
|
arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -284,7 +282,7 @@ viewall(Arg *arg) {
|
|||||||
for(i = 0; i < ntags; i++)
|
for(i = 0; i < ntags; i++)
|
||||||
seltag[i] = True;
|
seltag[i] = True;
|
||||||
reorder();
|
reorder();
|
||||||
arrange(NULL);
|
arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -294,18 +292,15 @@ zoom(Arg *arg) {
|
|||||||
|
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(sel->isfloat || (arrange == dofloat)) {
|
if(sel->isfloat || (arrange == dofloat)) {
|
||||||
togglemax(sel);
|
togglemax(sel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(n = 0, c = clients; c; c = c->next)
|
for(n = 0, c = clients; c; c = c->next)
|
||||||
if(isvisible(c) && !c->isfloat)
|
if(isvisible(c) && !c->isfloat)
|
||||||
n++;
|
n++;
|
||||||
if(n < 2 || (arrange == dofloat))
|
if(n < 2 || (arrange == dofloat))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if((c = sel) == nexttiled(clients))
|
if((c = sel) == nexttiled(clients))
|
||||||
if(!(c = nexttiled(c->next)))
|
if(!(c = nexttiled(c->next)))
|
||||||
return;
|
return;
|
||||||
@ -315,5 +310,5 @@ zoom(Arg *arg) {
|
|||||||
c->next = clients;
|
c->next = clients;
|
||||||
clients = c;
|
clients = c;
|
||||||
focus(c);
|
focus(c);
|
||||||
arrange(NULL);
|
arrange();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user