Compare commits
60 Commits
Author | SHA1 | Date | |
---|---|---|---|
2c6be7239f | |||
d934296476 | |||
39ae286861 | |||
59e65d1709 | |||
9fdd2cd1a9 | |||
e1deda9e04 | |||
199a601611 | |||
492c6f10fc | |||
caa7ab5362 | |||
f3e672efd8 | |||
02d5dddc00 | |||
c789941bba | |||
e45b3ced67 | |||
5a9af492ae | |||
32563abe86 | |||
70c7b432ea | |||
69dfcaa317 | |||
6ee8e3e93b | |||
8439369db9 | |||
81658eaab3 | |||
81aebf8cae | |||
fa32f02a43 | |||
598e22907e | |||
1e826ddd3e | |||
a967d7f664 | |||
ce450c5bf1 | |||
8f5f7a5b5a | |||
5ad2828c57 | |||
b896b58d6d | |||
fef6c5c66b | |||
37e062b0ed | |||
cf58091736 | |||
2aef8b9b4c | |||
d96307cbe4 | |||
124866e269 | |||
ab3d6a7dfe | |||
c67dbb28e4 | |||
b8bccb4ac5 | |||
b6b2f584ec | |||
f7bdb39d9e | |||
ecd9c3e222 | |||
216099d072 | |||
fc2e3eae20 | |||
f9e7a33019 | |||
7c9fa2566f | |||
22399a3bc0 | |||
ad2508f957 | |||
b078599833 | |||
1e80207876 | |||
464fc2cd18 | |||
be8d6d40f6 | |||
f0c2353393 | |||
a730213c3b | |||
399993c6b5 | |||
4d318060a2 | |||
540d5eed46 | |||
7d071ce2bd | |||
93aeaa53c9 | |||
06f9f346e6 | |||
5c48012ad2 |
4
.hgtags
4
.hgtags
@ -40,3 +40,7 @@ d3876aa792923f9a95f7ad0c7f0134533404df35 3.2.2
|
|||||||
75b1b25fe0d7e29400baf30568153f668324928b 3.6
|
75b1b25fe0d7e29400baf30568153f668324928b 3.6
|
||||||
20ec6976cee1fcfee0c2f354ae382ee3f9f68efa 3.6.1
|
20ec6976cee1fcfee0c2f354ae382ee3f9f68efa 3.6.1
|
||||||
baee494346e520f8dee2cee9491b8350064770d2 3.7
|
baee494346e520f8dee2cee9491b8350064770d2 3.7
|
||||||
|
2ea201354cf016407ea93e1e390d1422940d29b0 3.8
|
||||||
|
55478328b2422c700c5404a774c85e77322f41a3 3.9
|
||||||
|
018c3846842291cb6c009dc087e7fe2f0ef53bea 4.0
|
||||||
|
00f4180df72b49aadb2933804fde4bfb33e5666d 4.1
|
||||||
|
7
LICENSE
7
LICENSE
@ -1,7 +1,10 @@
|
|||||||
MIT/X Consortium License
|
MIT/X Consortium License
|
||||||
|
|
||||||
(C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
|
© 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
|
||||||
(C)opyright MMVI-MMVII Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
||||||
|
© 2006-2007 Jukka Salmi <jukka at salmi dot ch>
|
||||||
|
© 2007 Premysl Hruby <dfenze at gmail dot com>
|
||||||
|
© 2007 Szabolcs Nagy <nszabolcs at gmail dot com>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
3
Makefile
3
Makefile
@ -1,5 +1,5 @@
|
|||||||
# dwm - dynamic window manager
|
# dwm - dynamic window manager
|
||||||
# (C)opyright MMVI-MMVII Anselm R. Garbe
|
# © 2006-2007 Anselm R. Garbe, Sander van Dijk
|
||||||
|
|
||||||
include config.mk
|
include config.mk
|
||||||
|
|
||||||
@ -27,7 +27,6 @@ config.h:
|
|||||||
dwm: ${OBJ}
|
dwm: ${OBJ}
|
||||||
@echo CC -o $@
|
@echo CC -o $@
|
||||||
@${CC} -o $@ ${OBJ} ${LDFLAGS}
|
@${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||||
@strip $@
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo cleaning
|
@echo cleaning
|
||||||
|
58
client.c
58
client.c
@ -1,6 +1,4 @@
|
|||||||
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* See LICENSE file for license details.
|
|
||||||
*/
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -129,8 +127,8 @@ detach(Client *c) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
focus(Client *c) {
|
focus(Client *c) {
|
||||||
if(c && !isvisible(c))
|
if((!c && selscreen)|| (c && !isvisible(c)))
|
||||||
return;
|
for(c = stack; c && !isvisible(c); c = c->snext);
|
||||||
if(sel && sel != c) {
|
if(sel && sel != c) {
|
||||||
grabbuttons(sel, False);
|
grabbuttons(sel, False);
|
||||||
XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
|
XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
|
||||||
@ -173,8 +171,9 @@ killclient(const char *arg) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
manage(Window w, XWindowAttributes *wa) {
|
manage(Window w, XWindowAttributes *wa) {
|
||||||
Client *c, *t;
|
Client *c, *t = NULL;
|
||||||
Window trans;
|
Window trans;
|
||||||
|
Status rettrans;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
c = emallocz(sizeof(Client));
|
c = emallocz(sizeof(Client));
|
||||||
@ -184,13 +183,13 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
c->y = wa->y;
|
c->y = wa->y;
|
||||||
c->w = wa->width;
|
c->w = wa->width;
|
||||||
c->h = wa->height;
|
c->h = wa->height;
|
||||||
|
c->oldborder = wa->border_width;
|
||||||
if(c->w == sw && c->h == sh) {
|
if(c->w == sw && c->h == sh) {
|
||||||
c->border = 0;
|
|
||||||
c->x = sx;
|
c->x = sx;
|
||||||
c->y = sy;
|
c->y = sy;
|
||||||
|
c->border = wa->border_width;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c->border = BORDERPX;
|
|
||||||
if(c->x + c->w + 2 * c->border > wax + waw)
|
if(c->x + c->w + 2 * c->border > wax + waw)
|
||||||
c->x = wax + waw - c->w - 2 * c->border;
|
c->x = wax + waw - c->w - 2 * c->border;
|
||||||
if(c->y + c->h + 2 * c->border > way + wah)
|
if(c->y + c->h + 2 * c->border > way + wah)
|
||||||
@ -199,29 +198,29 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
c->x = wax;
|
c->x = wax;
|
||||||
if(c->y < way)
|
if(c->y < way)
|
||||||
c->y = way;
|
c->y = way;
|
||||||
|
c->border = BORDERPX;
|
||||||
}
|
}
|
||||||
updatesizehints(c);
|
|
||||||
XSelectInput(dpy, w,
|
|
||||||
StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
|
|
||||||
XGetTransientForHint(dpy, w, &trans);
|
|
||||||
grabbuttons(c, False);
|
|
||||||
wc.border_width = c->border;
|
wc.border_width = c->border;
|
||||||
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
|
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
|
||||||
XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
|
XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
|
||||||
configure(c); /* propagates border_width, if size doesn't change */
|
configure(c); /* propagates border_width, if size doesn't change */
|
||||||
|
updatesizehints(c);
|
||||||
|
XSelectInput(dpy, w,
|
||||||
|
StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
|
||||||
|
grabbuttons(c, False);
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
for(t = clients; t && t->win != trans; t = t->next);
|
if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
|
||||||
|
for(t = clients; t && t->win != trans; t = t->next);
|
||||||
settags(c, t);
|
settags(c, t);
|
||||||
if(!c->isfloating)
|
if(!c->isfloating)
|
||||||
c->isfloating = (t != NULL) || c->isfixed;
|
c->isfloating = (rettrans == Success) || c->isfixed;
|
||||||
attach(c);
|
attach(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
c->isbanned = True;
|
c->isbanned = True;
|
||||||
XMoveWindow(dpy, w, c->x + 2 * sw, c->y);
|
XMoveWindow(dpy, w, c->x + 2 * sw, c->y);
|
||||||
XMapWindow(dpy, w);
|
XMapWindow(dpy, w);
|
||||||
setclientstate(c, NormalState);
|
setclientstate(c, NormalState);
|
||||||
if(isvisible(c))
|
focus(c);
|
||||||
focus(c);
|
|
||||||
lt->arrange();
|
lt->arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +232,7 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
|
|||||||
if(w <= 0 || h <= 0)
|
if(w <= 0 || h <= 0)
|
||||||
return;
|
return;
|
||||||
if(sizehints) {
|
if(sizehints) {
|
||||||
if(c->minay > 0 && c->maxay && (h - c->baseh) > 0) {
|
if(c->minay > 0 && c->maxay > 0 && (h - c->baseh) > 0) {
|
||||||
dx = (float)(w - c->basew);
|
dx = (float)(w - c->basew);
|
||||||
dy = (float)(h - c->baseh);
|
dy = (float)(h - c->baseh);
|
||||||
min = (float)(c->minax) / (float)(c->minay);
|
min = (float)(c->minax) / (float)(c->minay);
|
||||||
@ -267,10 +266,8 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
|
|||||||
if(c->inch)
|
if(c->inch)
|
||||||
h -= (h - c->baseh) % c->inch;
|
h -= (h - c->baseh) % c->inch;
|
||||||
}
|
}
|
||||||
if(w == sw && h == sh)
|
if(w <= 0 || h <= 0)
|
||||||
c->border = 0;
|
return;
|
||||||
else
|
|
||||||
c->border = BORDERPX;
|
|
||||||
/* offscreen appearance fixes */
|
/* offscreen appearance fixes */
|
||||||
if(x > sw)
|
if(x > sw)
|
||||||
x = sw - w - 2 * c->border;
|
x = sw - w - 2 * c->border;
|
||||||
@ -297,6 +294,8 @@ togglefloating(const char *arg) {
|
|||||||
if(!sel || lt->arrange == floating)
|
if(!sel || lt->arrange == floating)
|
||||||
return;
|
return;
|
||||||
sel->isfloating = !sel->isfloating;
|
sel->isfloating = !sel->isfloating;
|
||||||
|
if(sel->isfloating)
|
||||||
|
resize(sel, sel->x, sel->y, sel->w, sel->h, True);
|
||||||
lt->arrange();
|
lt->arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,31 +365,32 @@ updatetitle(Client *c) {
|
|||||||
if(!name.nitems)
|
if(!name.nitems)
|
||||||
return;
|
return;
|
||||||
if(name.encoding == XA_STRING)
|
if(name.encoding == XA_STRING)
|
||||||
strncpy(c->name, (char *)name.value, sizeof c->name);
|
strncpy(c->name, (char *)name.value, sizeof c->name - 1);
|
||||||
else {
|
else {
|
||||||
if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success
|
if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success
|
||||||
&& n > 0 && *list)
|
&& n > 0 && *list)
|
||||||
{
|
{
|
||||||
strncpy(c->name, *list, sizeof c->name);
|
strncpy(c->name, *list, sizeof c->name - 1);
|
||||||
XFreeStringList(list);
|
XFreeStringList(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
c->name[sizeof c->name - 1] = '\0';
|
||||||
XFree(name.value);
|
XFree(name.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
unmanage(Client *c) {
|
unmanage(Client *c) {
|
||||||
Client *nc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
|
wc.border_width = c->oldborder;
|
||||||
/* The server grab construct avoids race conditions. */
|
/* The server grab construct avoids race conditions. */
|
||||||
XGrabServer(dpy);
|
XGrabServer(dpy);
|
||||||
XSetErrorHandler(xerrordummy);
|
XSetErrorHandler(xerrordummy);
|
||||||
|
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
|
||||||
detach(c);
|
detach(c);
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
if(sel == c) {
|
if(sel == c)
|
||||||
for(nc = stack; nc && !isvisible(nc); nc = nc->snext);
|
focus(NULL);
|
||||||
focus(nc);
|
|
||||||
}
|
|
||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||||
setclientstate(c, WithdrawnState);
|
setclientstate(c, WithdrawnState);
|
||||||
free(c->tags);
|
free(c->tags);
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* See LICENSE file for license details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
|
#define BARPOS BarTop /* BarBot, BarOff */
|
||||||
#define BORDERPX 1
|
#define BORDERPX 1
|
||||||
#define FONT "-*-proggyclean-medium-r-*-*-13-*-*-*-*-*-*-*"
|
#define FONT "-*-pixelcarnage monospace-*-r-*-*-14-*-*-*-*-*-*-*"
|
||||||
#define NORMBORDERCOLOR "#333"
|
#define NORMBORDERCOLOR "#333"
|
||||||
#define NORMBGCOLOR "#222"
|
#define NORMBGCOLOR "#222"
|
||||||
#define NORMFGCOLOR "#ccc"
|
#define NORMFGCOLOR "#ccc"
|
||||||
#define SELBORDERCOLOR "#8c8"
|
#define SELBORDERCOLOR "#8c8"
|
||||||
#define SELBGCOLOR "#555"
|
#define SELBGCOLOR "#555"
|
||||||
#define SELFGCOLOR "#fff"
|
#define SELFGCOLOR "#fff"
|
||||||
#define TOPBAR True /* False */
|
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
#define TAGS \
|
#define TAGS \
|
||||||
@ -47,6 +45,7 @@ static Key key[] = { \
|
|||||||
{ MODKEY|ShiftMask, XK_Return, spawn, \
|
{ MODKEY|ShiftMask, XK_Return, spawn, \
|
||||||
"exec urxvtcd -tr -bg '#222' -fg '#eee' -cr '#eee' +sb -fn '"FONT"'" }, \
|
"exec urxvtcd -tr -bg '#222' -fg '#eee' -cr '#eee' +sb -fn '"FONT"'" }, \
|
||||||
{ MODKEY, XK_space, setlayout, NULL }, \
|
{ MODKEY, XK_space, setlayout, NULL }, \
|
||||||
|
{ MODKEY, XK_b, togglebar, NULL }, \
|
||||||
{ MODKEY, XK_h, incmasterw, "-32" }, \
|
{ MODKEY, XK_h, incmasterw, "-32" }, \
|
||||||
{ MODKEY, XK_l, incmasterw, "32" }, \
|
{ MODKEY, XK_l, incmasterw, "32" }, \
|
||||||
{ MODKEY|ShiftMask, XK_j, incnmaster, "1" }, \
|
{ MODKEY|ShiftMask, XK_j, incnmaster, "1" }, \
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* See LICENSE file for license details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
|
#define BARPOS BarTop /* BarBot, BarOff */
|
||||||
#define BORDERPX 1
|
#define BORDERPX 1
|
||||||
#define FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*"
|
#define FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*"
|
||||||
#define NORMBORDERCOLOR "#dddddd"
|
#define NORMBORDERCOLOR "#dddddd"
|
||||||
@ -11,7 +10,6 @@
|
|||||||
#define SELBORDERCOLOR "#ff0000"
|
#define SELBORDERCOLOR "#ff0000"
|
||||||
#define SELBGCOLOR "#006699"
|
#define SELBGCOLOR "#006699"
|
||||||
#define SELFGCOLOR "#ffffff"
|
#define SELFGCOLOR "#ffffff"
|
||||||
#define TOPBAR True /* False */
|
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
#define TAGS \
|
#define TAGS \
|
||||||
@ -45,6 +43,7 @@ static Key key[] = { \
|
|||||||
{ MODKEY|ShiftMask, XK_Return, spawn, "exec xterm" }, \
|
{ MODKEY|ShiftMask, XK_Return, spawn, "exec xterm" }, \
|
||||||
{ MODKEY, XK_p, spawn, "exe=`dmenu_path | dmenu` && exec $exe" }, \
|
{ MODKEY, XK_p, spawn, "exe=`dmenu_path | dmenu` && exec $exe" }, \
|
||||||
{ MODKEY, XK_space, setlayout, NULL }, \
|
{ MODKEY, XK_space, setlayout, NULL }, \
|
||||||
|
{ MODKEY, XK_b, togglebar, NULL }, \
|
||||||
{ MODKEY, XK_h, incmasterw, "-32" }, \
|
{ MODKEY, XK_h, incmasterw, "-32" }, \
|
||||||
{ MODKEY, XK_l, incmasterw, "32" }, \
|
{ MODKEY, XK_l, incmasterw, "32" }, \
|
||||||
{ MODKEY|ShiftMask, XK_j, incnmaster, "1" }, \
|
{ MODKEY|ShiftMask, XK_j, incnmaster, "1" }, \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# dwm version
|
# dwm version
|
||||||
VERSION = 3.8
|
VERSION = 4.2
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
|
|||||||
|
|
||||||
# flags
|
# flags
|
||||||
CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\"
|
CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\"
|
||||||
LDFLAGS = ${LIBS}
|
LDFLAGS = -s ${LIBS}
|
||||||
#CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
|
#CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
|
||||||
#LDFLAGS = -g ${LIBS}
|
#LDFLAGS = -g ${LIBS}
|
||||||
|
|
||||||
|
4
draw.c
4
draw.c
@ -1,6 +1,4 @@
|
|||||||
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* See LICENSE file for license details.
|
|
||||||
*/
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
11
dwm.1
11
dwm.1
@ -59,6 +59,9 @@ Start
|
|||||||
.B Mod1\-Return
|
.B Mod1\-Return
|
||||||
Zooms/cycles current window to/from master area (tiled layout only).
|
Zooms/cycles current window to/from master area (tiled layout only).
|
||||||
.TP
|
.TP
|
||||||
|
.B Mod1\-b
|
||||||
|
Shows/hides the status bar.
|
||||||
|
.TP
|
||||||
.B Mod1\-j
|
.B Mod1\-j
|
||||||
Focus next window.
|
Focus next window.
|
||||||
.TP
|
.TP
|
||||||
@ -146,3 +149,11 @@ you can use JDK 1.4 (which doesn't contain the XToolkit/XAWT backend) or you
|
|||||||
can set the following environment variable (to use the older Motif
|
can set the following environment variable (to use the older Motif
|
||||||
backend instead):
|
backend instead):
|
||||||
.BR AWT_TOOLKIT=MToolkit .
|
.BR AWT_TOOLKIT=MToolkit .
|
||||||
|
.P
|
||||||
|
Recent GTK 2.10.9+ versions contain a broken
|
||||||
|
.BR Save\-As
|
||||||
|
file dialog implementation,
|
||||||
|
which requests to reconfigure its window size in an endless loop. However, its
|
||||||
|
window is still respondable during this state, so you can simply ignore the flicker
|
||||||
|
until a new GTK version appears, which will fix this bug, approximately
|
||||||
|
GTK 2.10.12+ versions.
|
||||||
|
30
dwm.h
30
dwm.h
@ -1,5 +1,4 @@
|
|||||||
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and 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
|
||||||
* driven through handling X events. In contrast to other X clients, a window
|
* driven through handling X events. In contrast to other X clients, a window
|
||||||
@ -36,10 +35,11 @@
|
|||||||
/* 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)
|
||||||
|
|
||||||
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
enum { BarTop, BarBot, BarOff }; /* bar position */
|
||||||
enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */
|
|
||||||
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||||
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
|
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
|
||||||
|
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
||||||
|
enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */
|
||||||
|
|
||||||
typedef struct Client Client;
|
typedef struct Client Client;
|
||||||
struct Client {
|
struct Client {
|
||||||
@ -49,7 +49,7 @@ struct Client {
|
|||||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||||
int minax, maxax, minay, maxay;
|
int minax, maxax, minay, maxay;
|
||||||
long flags;
|
long flags;
|
||||||
unsigned int border;
|
unsigned int border, oldborder;
|
||||||
Bool isbanned, isfixed, ismax, isfloating;
|
Bool isbanned, isfixed, ismax, isfloating;
|
||||||
Bool *tags;
|
Bool *tags;
|
||||||
Client *next;
|
Client *next;
|
||||||
@ -82,7 +82,7 @@ extern const char *tags[]; /* all tags */
|
|||||||
char stext[256]; /* status text */
|
char stext[256]; /* status text */
|
||||||
int screen, sx, sy, sw, sh; /* screen geometry */
|
int screen, sx, sy, sw, sh; /* screen geometry */
|
||||||
int wax, way, wah, waw; /* windowarea geometry */
|
int wax, way, wah, waw; /* windowarea geometry */
|
||||||
unsigned int bh, blw; /* bar height, bar layout label width */
|
unsigned int bh, blw, bpos; /* bar height, bar layout label width, bar position */
|
||||||
unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */
|
unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */
|
||||||
void (*handler[LASTEvent])(XEvent *); /* event handler */
|
void (*handler[LASTEvent])(XEvent *); /* event handler */
|
||||||
Atom wmatom[WMLast], netatom[NetLast];
|
Atom wmatom[WMLast], netatom[NetLast];
|
||||||
@ -98,13 +98,13 @@ Window root, barwin;
|
|||||||
void attach(Client *c); /* attaches c to global client list */
|
void attach(Client *c); /* attaches c to global client list */
|
||||||
void configure(Client *c); /* send synthetic configure event */
|
void configure(Client *c); /* send synthetic configure event */
|
||||||
void detach(Client *c); /* detaches c from global client list */
|
void detach(Client *c); /* detaches c from global client list */
|
||||||
void focus(Client *c); /* focus c, c may be NULL */
|
void focus(Client *c); /* focus c if visible && !NULL, or focus top visible */
|
||||||
void killclient(const char *arg); /* kill c nicely */
|
void killclient(const char *arg); /* kill sel nicely */
|
||||||
void manage(Window w, XWindowAttributes *wa); /* manage new client */
|
void manage(Window w, XWindowAttributes *wa); /* manage new client */
|
||||||
void resize(Client *c, int x, int y,
|
void resize(Client *c, int x, int y,
|
||||||
int w, int h, Bool sizehints); /* resize with given coordinates c*/
|
int w, int h, Bool sizehints); /* resize with given coordinates c*/
|
||||||
void togglefloating(const char *arg); /* toggles focused client between floating/tiled state */
|
void togglefloating(const char *arg); /* toggles sel between floating/tiled state */
|
||||||
void updatesizehints(Client *c); /* update the size hint variables of c */
|
void updatesizehints(Client *c); /* update the size hint variables of c */
|
||||||
void updatetitle(Client *c); /* update the name of c */
|
void updatetitle(Client *c); /* update the name of c */
|
||||||
void unmanage(Client *c); /* destroy c */
|
void unmanage(Client *c); /* destroy c */
|
||||||
|
|
||||||
@ -124,11 +124,13 @@ void incnmaster(const char *arg); /* increments nmaster with arg's index value *
|
|||||||
void initlayouts(void); /* initialize layout array */
|
void initlayouts(void); /* initialize layout array */
|
||||||
Client *nexttiled(Client *c); /* returns tiled successor of c */
|
Client *nexttiled(Client *c); /* returns tiled successor of c */
|
||||||
void restack(void); /* restores z layers of all clients */
|
void restack(void); /* restores z layers of all clients */
|
||||||
void setlayout(const char *arg); /* sets layout, -1 toggles */
|
void setlayout(const char *arg); /* sets layout, NULL means next layout */
|
||||||
void togglemax(const char *arg); /* toggles maximization of floating client */
|
void togglebar(const char *arg); /* shows/hides the bar */
|
||||||
|
void togglemax(const char *arg); /* toggles maximization of floating client */
|
||||||
void zoom(const char *arg); /* zooms the focused client to master area, arg is ignored */
|
void zoom(const char *arg); /* zooms the focused client to master area, arg is ignored */
|
||||||
|
|
||||||
/* main.c */
|
/* main.c */
|
||||||
|
void updatebarpos(void); /* updates the bar position */
|
||||||
void quit(const char *arg); /* quit dwm nicely */
|
void quit(const char *arg); /* quit dwm nicely */
|
||||||
int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
|
int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
|
||||||
|
|
||||||
@ -136,8 +138,8 @@ int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
|
|||||||
void compileregs(void); /* initialize regexps of rules defined in config.h */
|
void compileregs(void); /* initialize regexps of rules defined in config.h */
|
||||||
Bool isvisible(Client *c); /* returns True if client is visible */
|
Bool isvisible(Client *c); /* returns True if client is visible */
|
||||||
void settags(Client *c, Client *trans); /* sets tags of c */
|
void settags(Client *c, Client *trans); /* sets tags of c */
|
||||||
void tag(const char *arg); /* tags c with arg's index */
|
void tag(const char *arg); /* tags sel with arg's index */
|
||||||
void toggletag(const char *arg); /* toggles c tags with arg's index */
|
void toggletag(const char *arg); /* toggles sel tags with arg's index */
|
||||||
void toggleview(const char *arg); /* toggles the tag with arg's index (in)visible */
|
void toggleview(const char *arg); /* toggles the tag with arg's index (in)visible */
|
||||||
void view(const char *arg); /* views the tag with arg's index */
|
void view(const char *arg); /* views the tag with arg's index */
|
||||||
|
|
||||||
|
29
event.c
29
event.c
@ -1,6 +1,4 @@
|
|||||||
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* See LICENSE file for license details.
|
|
||||||
*/
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -185,6 +183,10 @@ configurerequest(XEvent *e) {
|
|||||||
c->w = ev->width;
|
c->w = ev->width;
|
||||||
if(ev->value_mask & CWHeight)
|
if(ev->value_mask & CWHeight)
|
||||||
c->h = ev->height;
|
c->h = ev->height;
|
||||||
|
if((c->x + c->w) > sw && c->isfloating)
|
||||||
|
c->x = sw / 2 - c->w / 2; /* center in x direction */
|
||||||
|
if((c->y + c->h) > sh && c->isfloating)
|
||||||
|
c->y = sh / 2 - c->h / 2; /* center in y direction */
|
||||||
if((ev->value_mask & (CWX | CWY))
|
if((ev->value_mask & (CWX | CWY))
|
||||||
&& !(ev->value_mask & (CWWidth | CWHeight)))
|
&& !(ev->value_mask & (CWWidth | CWHeight)))
|
||||||
configure(c);
|
configure(c);
|
||||||
@ -207,6 +209,21 @@ configurerequest(XEvent *e) {
|
|||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
configurenotify(XEvent *e) {
|
||||||
|
XConfigureEvent *ev = &e->xconfigure;
|
||||||
|
|
||||||
|
if (ev->window == root && (ev->width != sw || ev->height != sh)) {
|
||||||
|
sw = ev->width;
|
||||||
|
sh = ev->height;
|
||||||
|
XFreePixmap(dpy, dc.drawable);
|
||||||
|
dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
|
||||||
|
XResizeWindow(dpy, barwin, sw, bh);
|
||||||
|
updatebarpos();
|
||||||
|
lt->arrange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
destroynotify(XEvent *e) {
|
destroynotify(XEvent *e) {
|
||||||
Client *c;
|
Client *c;
|
||||||
@ -223,12 +240,11 @@ enternotify(XEvent *e) {
|
|||||||
|
|
||||||
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
|
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
|
||||||
return;
|
return;
|
||||||
if((c = getclient(ev->window)) && isvisible(c))
|
if((c = getclient(ev->window)))
|
||||||
focus(c);
|
focus(c);
|
||||||
else if(ev->window == root) {
|
else if(ev->window == root) {
|
||||||
selscreen = True;
|
selscreen = True;
|
||||||
for(c = stack; c && !isvisible(c); c = c->snext);
|
focus(NULL);
|
||||||
focus(c);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,6 +349,7 @@ unmapnotify(XEvent *e) {
|
|||||||
void (*handler[LASTEvent]) (XEvent *) = {
|
void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
[ButtonPress] = buttonpress,
|
[ButtonPress] = buttonpress,
|
||||||
[ConfigureRequest] = configurerequest,
|
[ConfigureRequest] = configurerequest,
|
||||||
|
[ConfigureNotify] = configurenotify,
|
||||||
[DestroyNotify] = destroynotify,
|
[DestroyNotify] = destroynotify,
|
||||||
[EnterNotify] = enternotify,
|
[EnterNotify] = enternotify,
|
||||||
[LeaveNotify] = leavenotify,
|
[LeaveNotify] = leavenotify,
|
||||||
|
94
layout.c
94
layout.c
@ -1,6 +1,4 @@
|
|||||||
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* See LICENSE file for license details.
|
|
||||||
*/
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@ -13,6 +11,22 @@ static unsigned int nlayouts = 0;
|
|||||||
static unsigned int masterw = MASTERWIDTH;
|
static unsigned int masterw = MASTERWIDTH;
|
||||||
static unsigned int nmaster = NMASTER;
|
static unsigned int nmaster = NMASTER;
|
||||||
|
|
||||||
|
static void
|
||||||
|
ban(Client *c) {
|
||||||
|
if (c->isbanned)
|
||||||
|
return;
|
||||||
|
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
||||||
|
c->isbanned = True;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
unban(Client *c) {
|
||||||
|
if (!c->isbanned)
|
||||||
|
return;
|
||||||
|
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||||
|
c->isbanned = False;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tile(void) {
|
tile(void) {
|
||||||
unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
|
unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
|
||||||
@ -28,9 +42,7 @@ tile(void) {
|
|||||||
|
|
||||||
for(i = 0, c = clients; c; c = c->next)
|
for(i = 0, c = clients; c; c = c->next)
|
||||||
if(isvisible(c)) {
|
if(isvisible(c)) {
|
||||||
if(c->isbanned)
|
unban(c);
|
||||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
|
||||||
c->isbanned = False;
|
|
||||||
if(c->isfloating)
|
if(c->isfloating)
|
||||||
continue;
|
continue;
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
@ -38,30 +50,31 @@ tile(void) {
|
|||||||
ny = way;
|
ny = way;
|
||||||
if(i < nmaster) {
|
if(i < nmaster) {
|
||||||
ny += i * mh;
|
ny += i * mh;
|
||||||
nw = mw - 2 * BORDERPX;
|
nw = mw - 2 * c->border;
|
||||||
nh = mh - 2 * BORDERPX;
|
nh = mh;
|
||||||
|
if(i + 1 == (n < nmaster ? n : nmaster)) /* remainder */
|
||||||
|
nh = wah - mh * i;
|
||||||
|
nh -= 2 * c->border;
|
||||||
}
|
}
|
||||||
else { /* tile window */
|
else { /* tile window */
|
||||||
nx += mw;
|
nx += mw;
|
||||||
nw = tw - 2 * BORDERPX;
|
nw = tw - 2 * c->border;
|
||||||
if(th > 2 * BORDERPX) {
|
if(th > 2 * c->border) {
|
||||||
ny += (i - nmaster) * th;
|
ny += (i - nmaster) * th;
|
||||||
nh = th - 2 * BORDERPX;
|
nh = th;
|
||||||
|
if(i + 1 == n) /* remainder */
|
||||||
|
nh = wah - th * (i - nmaster);
|
||||||
|
nh -= 2 * c->border;
|
||||||
}
|
}
|
||||||
else /* fallback if th <= 2 * BORDERPX */
|
else /* fallback if th <= 2 * c->border */
|
||||||
nh = wah - 2 * BORDERPX;
|
nh = wah - 2 * c->border;
|
||||||
}
|
}
|
||||||
resize(c, nx, ny, nw, nh, False);
|
resize(c, nx, ny, nw, nh, False);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
c->isbanned = True;
|
ban(c);
|
||||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
focus(NULL);
|
||||||
}
|
|
||||||
if(!sel || !isvisible(sel)) {
|
|
||||||
for(c = stack; c && !isvisible(c); c = c->snext);
|
|
||||||
focus(c);
|
|
||||||
}
|
|
||||||
restack();
|
restack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,22 +86,16 @@ void
|
|||||||
floating(void) {
|
floating(void) {
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(c = clients; c; c = c->next) {
|
for(c = clients; c; c = c->next)
|
||||||
if(isvisible(c)) {
|
if(isvisible(c)) {
|
||||||
if(c->isbanned)
|
if(c->isbanned)
|
||||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||||
c->isbanned = False;
|
c->isbanned = False;
|
||||||
resize(c, c->x, c->y, c->w, c->h, True);
|
resize(c, c->x, c->y, c->w, c->h, True);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
c->isbanned = True;
|
ban(c);
|
||||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
focus(NULL);
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!sel || !isvisible(sel)) {
|
|
||||||
for(c = stack; c && !isvisible(c); c = c->snext);
|
|
||||||
focus(c);
|
|
||||||
}
|
|
||||||
restack();
|
restack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +132,7 @@ incmasterw(const char *arg) {
|
|||||||
masterw = MASTERWIDTH;
|
masterw = MASTERWIDTH;
|
||||||
else {
|
else {
|
||||||
i = atoi(arg);
|
i = atoi(arg);
|
||||||
if(waw * (masterw + i) / 1000 >= waw - 2 * BORDERPX
|
if(waw * (masterw + i) / 1000 >= waw - 2 * BORDERPX
|
||||||
|| waw * (masterw + i) / 1000 <= 2 * BORDERPX)
|
|| waw * (masterw + i) / 1000 <= 2 * BORDERPX)
|
||||||
return;
|
return;
|
||||||
masterw += i;
|
masterw += i;
|
||||||
@ -199,11 +206,9 @@ setlayout(const char *arg) {
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(!arg) {
|
if(!arg) {
|
||||||
for(i = 0; i < nlayouts && lt != &layout[i]; i++);
|
lt++;
|
||||||
if(i == nlayouts - 1)
|
if(lt == layout + nlayouts)
|
||||||
lt = &layout[0];
|
lt = layout;
|
||||||
else
|
|
||||||
lt = &layout[++i];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
i = atoi(arg);
|
i = atoi(arg);
|
||||||
@ -217,6 +222,16 @@ setlayout(const char *arg) {
|
|||||||
drawstatus();
|
drawstatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
togglebar(const char *arg) {
|
||||||
|
if(bpos == BarOff)
|
||||||
|
bpos = (BARPOS == BarOff) ? BarTop : BARPOS;
|
||||||
|
else
|
||||||
|
bpos = BarOff;
|
||||||
|
updatebarpos();
|
||||||
|
lt->arrange();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
togglemax(const char *arg) {
|
togglemax(const char *arg) {
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
@ -238,13 +253,10 @@ togglemax(const char *arg) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
zoom(const char *arg) {
|
zoom(const char *arg) {
|
||||||
unsigned int n;
|
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
if(!sel || lt->arrange != tile || sel->isfloating)
|
if(!sel || lt->arrange == floating || sel->isfloating)
|
||||||
return;
|
return;
|
||||||
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
|
|
||||||
n++;
|
|
||||||
if((c = sel) == nexttiled(clients))
|
if((c = sel) == nexttiled(clients))
|
||||||
if(!(c = nexttiled(c->next)))
|
if(!(c = nexttiled(c->next)))
|
||||||
return;
|
return;
|
||||||
|
51
main.c
51
main.c
@ -1,7 +1,4 @@
|
|||||||
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* See LICENSE file for license details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
@ -19,7 +16,7 @@
|
|||||||
|
|
||||||
char stext[256];
|
char stext[256];
|
||||||
int screen, sx, sy, sw, sh, wax, way, waw, wah;
|
int screen, sx, sy, sw, sh, wax, way, waw, wah;
|
||||||
unsigned int bh, ntags, numlockmask;
|
unsigned int bh, bpos, ntags, numlockmask;
|
||||||
Atom wmatom[WMLast], netatom[NetLast];
|
Atom wmatom[WMLast], netatom[NetLast];
|
||||||
Bool *seltag;
|
Bool *seltag;
|
||||||
Bool selscreen = True;
|
Bool selscreen = True;
|
||||||
@ -82,7 +79,7 @@ initfont(const char *fontstr) {
|
|||||||
dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
|
dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
|
||||||
if(missing) {
|
if(missing) {
|
||||||
while(n--)
|
while(n--)
|
||||||
fprintf(stderr, "missing fontset: %s\n", missing[n]);
|
fprintf(stderr, "dwm: missing fontset: %s\n", missing[n]);
|
||||||
XFreeStringList(missing);
|
XFreeStringList(missing);
|
||||||
}
|
}
|
||||||
if(dc.font.set) {
|
if(dc.font.set) {
|
||||||
@ -164,9 +161,10 @@ setup(void) {
|
|||||||
XFreeModifiermap(modmap);
|
XFreeModifiermap(modmap);
|
||||||
/* select for events */
|
/* select for events */
|
||||||
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
||||||
| EnterWindowMask | LeaveWindowMask;
|
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
||||||
wa.cursor = cursor[CurNormal];
|
wa.cursor = cursor[CurNormal];
|
||||||
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
|
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
|
||||||
|
XSelectInput(dpy, root, wa.event_mask);
|
||||||
grabkeys();
|
grabkeys();
|
||||||
compileregs();
|
compileregs();
|
||||||
for(ntags = 0; tags[ntags]; ntags++);
|
for(ntags = 0; tags[ntags]; ntags++);
|
||||||
@ -190,17 +188,14 @@ setup(void) {
|
|||||||
wa.override_redirect = 1;
|
wa.override_redirect = 1;
|
||||||
wa.background_pixmap = ParentRelative;
|
wa.background_pixmap = ParentRelative;
|
||||||
wa.event_mask = ButtonPressMask | ExposureMask;
|
wa.event_mask = ButtonPressMask | ExposureMask;
|
||||||
barwin = XCreateWindow(dpy, root, sx, sy + (TOPBAR ? 0 : sh - bh), sw, bh, 0,
|
barwin = XCreateWindow(dpy, root, sx, sy, sw, bh, 0,
|
||||||
DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
|
DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
|
||||||
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
||||||
XDefineCursor(dpy, barwin, cursor[CurNormal]);
|
XDefineCursor(dpy, barwin, cursor[CurNormal]);
|
||||||
|
bpos = BARPOS;
|
||||||
|
updatebarpos();
|
||||||
XMapRaised(dpy, barwin);
|
XMapRaised(dpy, barwin);
|
||||||
strcpy(stext, "dwm-"VERSION);
|
strcpy(stext, "dwm-"VERSION);
|
||||||
/* windowarea */
|
|
||||||
wax = sx;
|
|
||||||
way = sy + (TOPBAR ? bh : 0);
|
|
||||||
wah = sh - bh;
|
|
||||||
waw = sw;
|
|
||||||
/* pixmap for everything */
|
/* 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);
|
||||||
@ -228,6 +223,32 @@ quit(const char *arg) {
|
|||||||
readin = running = False;
|
readin = running = False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
updatebarpos(void) {
|
||||||
|
XEvent ev;
|
||||||
|
|
||||||
|
wax = sx;
|
||||||
|
way = sy;
|
||||||
|
wah = sh;
|
||||||
|
waw = sw;
|
||||||
|
switch(bpos) {
|
||||||
|
default:
|
||||||
|
wah -= bh;
|
||||||
|
way += bh;
|
||||||
|
XMoveWindow(dpy, barwin, sx, sy);
|
||||||
|
break;
|
||||||
|
case BarBot:
|
||||||
|
wah -= bh;
|
||||||
|
XMoveWindow(dpy, barwin, sx, sy + wah);
|
||||||
|
break;
|
||||||
|
case BarOff:
|
||||||
|
XMoveWindow(dpy, barwin, sx, sy - bh);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
XSync(dpy, False);
|
||||||
|
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||||
|
}
|
||||||
|
|
||||||
/* 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.
|
||||||
@ -255,8 +276,8 @@ main(int argc, char *argv[]) {
|
|||||||
fd_set rd;
|
fd_set rd;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
if(argc == 2 && !strncmp("-v", argv[1], 3))
|
if(argc == 2 && !strcmp("-v", argv[1]))
|
||||||
eprint("dwm-"VERSION", (C)opyright MMVI-MMVII Anselm R. Garbe\n");
|
eprint("dwm-"VERSION", © 2006-2007 A. R. Garbe, S. van Dijk, J. Salmi, P. Hruby, S. Nagy\n");
|
||||||
else if(argc != 1)
|
else if(argc != 1)
|
||||||
eprint("usage: dwm [-v]\n");
|
eprint("usage: dwm [-v]\n");
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
|
4
tag.c
4
tag.c
@ -1,6 +1,4 @@
|
|||||||
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* See LICENSE file for license details.
|
|
||||||
*/
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
4
util.c
4
util.c
@ -1,6 +1,4 @@
|
|||||||
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* See LICENSE file for license details.
|
|
||||||
*/
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
Reference in New Issue
Block a user