1
0
mirror of git://git.suckless.org/dwm synced 2025-08-02 13:12:09 -07:00

Compare commits

..

8 Commits
2.2 ... 2.3

Author SHA1 Message Date
arg@mig29
4606d218c3 using the term 'indicated' instead of 'higlighted' 2006-11-23 16:00:16 +01:00
arg@mig29
d37d0f24e6 updated man page with the bottom right corner indicator 2006-11-23 15:59:16 +01:00
arg@mig29
321e8d51ed fififif 2006-11-22 16:17:50 +01:00
arg@mig29
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
arg@mig29
7d168a2621 returning to old bar colorization behavior, like sander proposed for consistency reasons 2006-11-21 15:03:08 +01:00
arg@mig29
931e712eac applied Gottox patches 2006-11-21 14:49:13 +01:00
arg@mig29
4ec04209e0 using iso10646 explicitely in arg's config.h 2006-11-21 12:17:47 +01:00
arg@mig29
82ddba88a2 Added tag 2.2 for changeset 7e92f58754ae6edb3225f26d754bd89c1ff458cf 2006-11-21 09:41:33 +01:00
9 changed files with 36 additions and 55 deletions

View File

@@ -20,3 +20,4 @@ c71952fa3c7ca848ec38a6923b5c6d0e18fff431 1.8
a5567a0d30112822db2627a04a2e7aa3b6c38148 1.9 a5567a0d30112822db2627a04a2e7aa3b6c38148 1.9
12deea36603da407e3f32640048846a3bd74a9ec 2.0 12deea36603da407e3f32640048846a3bd74a9ec 2.0
a2c465098a3b972bbed00feda9804b6aae1e9531 2.1 a2c465098a3b972bbed00feda9804b6aae1e9531 2.1
7e92f58754ae6edb3225f26d754bd89c1ff458cf 2.2

View File

@@ -9,7 +9,7 @@ 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 "#336699" #define SELBGCOLOR "#336699"

View File

@@ -1,5 +1,5 @@
# dwm version # dwm version
VERSION = 2.2 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.

2
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;

5
main.c
View File

@@ -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;
@@ -144,7 +145,7 @@ setup(void) {
strcpy(stext, "dwm-"VERSION); strcpy(stext, "dwm-"VERSION);
/* windowarea */ /* windowarea */
wax = sx; wax = sx;
way = bh; way = sy + bh;
wah = sh - bh; wah = sh - bh;
waw = sw; waw = sw;
/* pixmap for everything */ /* pixmap for everything */

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();
} }

33
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;
@@ -247,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();
} }
@@ -258,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();
} }
@@ -268,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();
} }