Compare commits

...

16 Commits
2.1 ... 2.3

Author SHA1 Message Date
4606d218c3 using the term 'indicated' instead of 'higlighted' 2006-11-23 16:00:16 +01:00
d37d0f24e6 updated man page with the bottom right corner indicator 2006-11-23 15:59:16 +01:00
321e8d51ed fififif 2006-11-22 16:17:50 +01:00
78f4b51757 added a similiar patch to Daves solution to indicate if there are clients with a specific tag 2006-11-22 14:57:09 +01:00
7d168a2621 returning to old bar colorization behavior, like sander proposed for consistency reasons 2006-11-21 15:03:08 +01:00
931e712eac applied Gottox patches 2006-11-21 14:49:13 +01:00
4ec04209e0 using iso10646 explicitely in arg's config.h 2006-11-21 12:17:47 +01:00
82ddba88a2 Added tag 2.2 for changeset 7e92f58754ae6edb3225f26d754bd89c1ff458cf 2006-11-21 09:41:33 +01:00
52a8cc8d46 nah reverting to my prev style, that's really the best 2006-11-18 21:33:33 +01:00
d175df8aa3 applying aluminium style for arg's config.h 2006-11-18 21:26:53 +01:00
b003a35fde applied Gottox' windowarea patch 2006-11-16 14:40:57 +01:00
df1a0f9445 using a more blue-ish color... 2006-11-08 17:16:38 +01:00
5b07b85838 making the selected color more lightning 2006-11-08 17:10:51 +01:00
f320cd203b next release will be 2.2 2006-11-03 09:22:40 +01:00
f78c16f8c6 applied Jukkas patch 2006-11-03 08:29:39 +01:00
0c5f47e720 Added tag 2.1 for changeset a2c465098a3b972bbed00feda9804b6aae1e9531 2006-11-02 10:18:22 +01:00
10 changed files with 77 additions and 91 deletions

View File

@ -19,3 +19,5 @@ d5ad819f2a66a40fa75dd2e44429f3bfc884d07b 1.7.1
c71952fa3c7ca848ec38a6923b5c6d0e18fff431 1.8 c71952fa3c7ca848ec38a6923b5c6d0e18fff431 1.8
a5567a0d30112822db2627a04a2e7aa3b6c38148 1.9 a5567a0d30112822db2627a04a2e7aa3b6c38148 1.9
12deea36603da407e3f32640048846a3bd74a9ec 2.0 12deea36603da407e3f32640048846a3bd74a9ec 2.0
a2c465098a3b972bbed00feda9804b6aae1e9531 2.1
7e92f58754ae6edb3225f26d754bd89c1ff458cf 2.2

View File

@ -9,13 +9,13 @@ const char *tags[] = { "dev", "work", "net", "fnord", NULL };
#define FLOATSYMBOL "><>" #define FLOATSYMBOL "><>"
#define TILESYMBOL "[]=" #define TILESYMBOL "[]="
#define FONT "-*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*" #define FONT "-*-terminus-medium-*-*-*-14-*-*-*-*-*-iso10646-*"
#define NORMBGCOLOR "#333333" #define NORMBGCOLOR "#333333"
#define NORMFGCOLOR "#dddddd" #define NORMFGCOLOR "#dddddd"
#define SELBGCOLOR "#333366" #define SELBGCOLOR "#336699"
#define SELFGCOLOR "#eeeeee" #define SELFGCOLOR "#eeeeee"
#define STATUSBGCOLOR "#222222" #define STATUSBGCOLOR "#222222"
#define STATUSFGCOLOR "#9999cc" #define STATUSFGCOLOR "#99ccff"
#define MASTER 600 /* per thousand */ #define MASTER 600 /* per thousand */
#define MODKEY Mod1Mask #define MODKEY Mod1Mask

View File

@ -1,5 +1,5 @@
# dwm version # dwm version
VERSION = 2.1 VERSION = 2.3
# Customize below to fit your system # Customize below to fit your system

37
draw.c
View File

@ -8,6 +8,16 @@
/* static */ /* static */
static Bool
isoccupied(unsigned int t)
{
Client *c;
for(c = clients; c; c = c->next)
if(c->tags[t])
return True;
return False;
}
static unsigned int static unsigned int
textnw(const char *text, unsigned int len) { textnw(const char *text, unsigned int len) {
XRectangle r; XRectangle r;
@ -20,7 +30,7 @@ textnw(const char *text, unsigned int len) {
} }
static void static void
drawtext(const char *text, unsigned long col[ColLast], Bool highlight) { drawtext(const char *text, unsigned long col[ColLast], Bool ldot, Bool rdot) {
int x, y, w, h; int x, y, w, h;
static char buf[256]; static char buf[256];
unsigned int len, olen; unsigned int len, olen;
@ -63,12 +73,18 @@ drawtext(const char *text, unsigned long col[ColLast], Bool highlight) {
XChangeGC(dpy, dc.gc, GCForeground | GCFont, &gcv); XChangeGC(dpy, dc.gc, GCForeground | GCFont, &gcv);
XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len);
} }
if(highlight) { if(ldot) {
r.x = dc.x + 2; r.x = dc.x + 2;
r.y = dc.y + 2; r.y = dc.y + 2;
r.width = r.height = (h + 2) / 4; r.width = r.height = (h + 2) / 4;
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
} }
if(rdot) {
r.width = r.height = (h + 2) / 4;
r.x = dc.x + dc.w - r.width - 2;
r.y = dc.y + dc.h - r.height - 2;
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
}
} }
/* extern */ /* extern */
@ -90,27 +106,24 @@ drawstatus(void) {
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])
drawtext(tags[i], dc.sel, sel && sel->tags[i]); drawtext(tags[i], dc.sel, sel && sel->tags[i], isoccupied(i));
else else
drawtext(tags[i], dc.norm, sel && sel->tags[i]); drawtext(tags[i], dc.norm, sel && sel->tags[i], isoccupied(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, 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 = bw - dc.w;
if(dc.x < x) { if(dc.x < x) {
dc.x = x; dc.x = x;
dc.w = bw - x; dc.w = bw - x;
} }
drawtext(stext, dc.status, False); drawtext(stext, dc.status, False, False);
if((dc.w = dc.x - x) > bh) { if((dc.w = dc.x - x) > bh) {
dc.x = x; dc.x = x;
if(sel) drawtext(sel ? sel->name : NULL, sel ? dc.sel : dc.norm, False, False);
drawtext(sel->name, dc.sel, False);
else
drawtext(NULL, dc.norm, False);
} }
XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
XSync(dpy, False); XSync(dpy, False);
@ -128,7 +141,7 @@ drawtitle(Client *c) {
XMapWindow(dpy, c->twin); XMapWindow(dpy, c->twin);
dc.x = dc.y = 0; dc.x = dc.y = 0;
dc.w = c->tw; dc.w = c->tw;
drawtext(c->name, dc.norm, False); drawtext(c->name, dc.norm, False,False);
XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0); XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0);
XSync(dpy, False); XSync(dpy, False);
} }

6
dwm.1
View File

@ -20,8 +20,10 @@ tags. Selecting certain tags displays all windows with these tags.
.P .P
dwm contains a small status bar which displays all available tags, the mode, dwm contains a small status bar which displays all available tags, the mode,
the title of the focused window, and the text read from standard input. The the title of the focused window, and the text read from standard input. The
selected tags are highlighted with a different color, the tags of the focused selected tags are indicated with a different color. The tags of the focused
window are highlighted with a small point. window are indicated with a small point in the top left corner. The tags which
are applied by any client are indicated with a small point in the bottom
right corner.
.P .P
dwm draws a 1-pixel border around windows to indicate the focus state. dwm draws a 1-pixel border around windows to indicate the focus state.
Unfocused windows contain a small bar in front of them displaying their title. Unfocused windows contain a small bar in front of them displaying their title.

3
dwm.h
View File

@ -82,7 +82,7 @@ struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh; int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int grav; int grav;
long flags; long flags;
unsigned int border, weight; unsigned int border;
Bool isfloat, isfixed, ismax; Bool isfloat, isfixed, ismax;
Bool *tags; Bool *tags;
Client *next; Client *next;
@ -96,6 +96,7 @@ 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 screen, sx, sy, sw, sh; /* screen geometry */ extern int screen, sx, sy, sw, sh; /* screen geometry */
extern int wax, way, wah, waw; /* windowarea geometry */
extern unsigned int master, ntags, numlockmask; /* master percent, 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)(void); /* arrange function, indicates mode */ extern void (*arrange)(void); /* arrange function, indicates mode */

16
event.c
View File

@ -48,14 +48,14 @@ movemouse(Client *c) {
XSync(dpy, False); XSync(dpy, False);
c->x = ocx + (ev.xmotion.x - x1); c->x = ocx + (ev.xmotion.x - x1);
c->y = ocy + (ev.xmotion.y - y1); c->y = ocy + (ev.xmotion.y - y1);
if(abs(sx + c->x) < SNAP) if(abs(wax + c->x) < SNAP)
c->x = sx; c->x = wax;
else if(abs((sx + sw) - (c->x + c->w)) < SNAP) else if(abs((wax + waw) - (c->x + c->w)) < SNAP)
c->x = sw - c->w - 2 * BORDERPX; c->x = wax + waw - c->w - 2 * BORDERPX;
if(abs((sy + bh) - c->y) < SNAP) if(abs(way - c->y) < SNAP)
c->y = sy + bh; c->y = way;
else if(abs((sy + sh) - (c->y + c->h)) < SNAP) else if(abs((way + wah) - (c->y + c->h)) < SNAP)
c->y = sh - c->h - 2 * BORDERPX; c->y = way + wah - c->h - 2 * BORDERPX;
resize(c, False, TopLeft); resize(c, False, TopLeft);
break; break;
} }

10
main.c
View File

@ -18,7 +18,7 @@
char stext[1024]; char stext[1024];
Bool *seltag; Bool *seltag;
int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh; int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh, wax, way, waw, wah;
unsigned int master, ntags, numlockmask; unsigned int master, ntags, numlockmask;
Atom wmatom[WMLast], netatom[NetLast]; Atom wmatom[WMLast], netatom[NetLast];
Bool running = True; Bool running = True;
@ -130,7 +130,8 @@ setup(void) {
sh = DisplayHeight(dpy, screen); sh = DisplayHeight(dpy, screen);
master = MASTER; master = MASTER;
/* bar */ /* bar */
bx = by = 0; bx = sx;
by = sy;
bw = sw; bw = sw;
dc.h = bh = dc.font.height + 2; dc.h = bh = dc.font.height + 2;
wa.override_redirect = 1; wa.override_redirect = 1;
@ -142,6 +143,11 @@ setup(void) {
XDefineCursor(dpy, barwin, cursor[CurNormal]); XDefineCursor(dpy, barwin, cursor[CurNormal]);
XMapRaised(dpy, barwin); XMapRaised(dpy, barwin);
strcpy(stext, "dwm-"VERSION); strcpy(stext, "dwm-"VERSION);
/* windowarea */
wax = sx;
way = sy + bh;
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);

3
tag.c
View File

@ -104,7 +104,6 @@ settags(Client *c, Client *trans) {
if(!matched) if(!matched)
for(i = 0; i < ntags; i++) for(i = 0; i < ntags; i++)
c->tags[i] = seltag[i]; c->tags[i] = seltag[i];
for(c->weight = 0; c->weight < ntags && !c->tags[c->weight]; c->weight++);
} }
void void
@ -116,7 +115,6 @@ tag(Arg *arg) {
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;
arrange(); arrange();
} }
@ -130,6 +128,5 @@ toggletag(Arg *arg) {
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;
arrange(); arrange();
} }

75
view.c
View File

@ -5,42 +5,12 @@
/* static */ /* static */
static Client *
minclient(void) {
Client *c, *min;
if((clients && clients->isfloat) || arrange == dofloat)
return clients; /* don't touch floating order */
for(min = c = clients; c; c = c->next)
if(c->weight < min->weight)
min = c;
return min;
}
static Client * static Client *
nexttiled(Client *c) { nexttiled(Client *c) {
for(c = getnext(c); c && c->isfloat; c = getnext(c->next)); for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
return c; return c;
} }
static void
reorder(void) {
Client *c, *newclients, *tail;
newclients = tail = NULL;
while((c = minclient())) {
detach(c);
if(tail) {
c->prev = tail;
tail->next = c;
tail = c;
}
else
tail = newclients = c;
}
clients = newclients;
}
static void static void
togglemax(Client *c) { togglemax(Client *c) {
XEvent ev; XEvent ev;
@ -49,10 +19,10 @@ togglemax(Client *c) {
return; return;
if((c->ismax = !c->ismax)) { if((c->ismax = !c->ismax)) {
c->rx = c->x; c->x = sx; c->rx = c->x; c->x = wax;
c->ry = c->y; c->y = bh; c->ry = c->y; c->y = way;
c->rw = c->w; c->w = sw - 2 * BORDERPX; c->rw = c->w; c->w = waw - 2 * BORDERPX;
c->rh = c->h; c->h = sh - bh - 2 * BORDERPX; c->rh = c->h; c->h = wah - 2 * BORDERPX;
} }
else { else {
c->x = c->rx; c->x = c->rx;
@ -99,17 +69,13 @@ dofloat(void) {
void void
dotile(void) { dotile(void) {
unsigned int i, n, mpx, stackw, stackh, th; unsigned int i, n, mpx, stackw, th;
Client *c; Client *c;
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; mpx = (waw * master) / 1000;
stackw = sw - mpx; stackw = waw - mpx;
stackh = sh - bh;
th = stackh;
if(n > 1)
th /= (n - 1);
for(i = 0, c = clients; c; c = c->next) for(i = 0, c = clients; c; c = c->next)
if(isvisible(c)) { if(isvisible(c)) {
@ -118,28 +84,26 @@ dotile(void) {
continue; continue;
} }
c->ismax = False; c->ismax = False;
c->x = sx; c->x = wax;
c->y = sy + bh; c->y = way;
if(n == 1) { /* only 1 window */ if(n == 1) { /* only 1 window */
c->w = sw - 2 * BORDERPX; c->w = waw - 2 * BORDERPX;
c->h = sh - 2 * BORDERPX - bh; c->h = wah - 2 * BORDERPX;
} }
else if(i == 0) { /* master window */ else if(i == 0) { /* master window */
c->w = mpx - 2 * BORDERPX; c->w = waw - stackw - 2 * BORDERPX;
c->h = sh - bh - 2 * BORDERPX; c->h = wah - 2 * BORDERPX;
th = wah / (n - 1);
} }
else { /* tile window */ else { /* tile window */
c->x += mpx; c->x += mpx;
c->w = stackw - 2 * BORDERPX; c->w = stackw - 2 * BORDERPX;
if(th > bh) { if(th > bh) {
c->y = sy + (i - 1) * th + bh; c->y = way + (i - 1) * th;
if(i + 1 == n)
c->h = sh - c->y - 2 * BORDERPX;
else
c->h = th - 2 * BORDERPX; c->h = th - 2 * BORDERPX;
} }
else /* fallback if th < bh */ else /* fallback if th < bh */
c->h = stackh - 2 * BORDERPX; c->h = wah - 2 * BORDERPX;
} }
resize(c, False, TopLeft); resize(c, False, TopLeft);
i++; i++;
@ -196,9 +160,13 @@ isvisible(Client *c) {
void void
resizemaster(Arg *arg) { resizemaster(Arg *arg) {
if(arg->i == 0)
master = MASTER;
else {
if(master + arg->i > 950 || master + arg->i < 50) if(master + arg->i > 950 || master + arg->i < 50)
return; return;
master += arg->i; master += arg->i;
}
arrange(); arrange();
} }
@ -249,7 +217,6 @@ toggleview(Arg *arg) {
for(i = 0; i < ntags && !seltag[i]; i++); for(i = 0; i < ntags && !seltag[i]; i++);
if(i == ntags) if(i == ntags)
seltag[arg->i] = True; /* cannot toggle last view */ seltag[arg->i] = True; /* cannot toggle last view */
reorder();
arrange(); arrange();
} }
@ -260,7 +227,6 @@ view(Arg *arg) {
for(i = 0; i < ntags; i++) for(i = 0; i < ntags; i++)
seltag[i] = False; seltag[i] = False;
seltag[arg->i] = True; seltag[arg->i] = True;
reorder();
arrange(); arrange();
} }
@ -270,7 +236,6 @@ viewall(Arg *arg) {
for(i = 0; i < ntags; i++) for(i = 0; i < ntags; i++)
seltag[i] = True; seltag[i] = True;
reorder();
arrange(); arrange();
} }