updated man page
This commit is contained in:
parent
c39df91ab9
commit
7e597ae204
22
client.c
22
client.c
@ -28,19 +28,15 @@ resizetitle(Client *c)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
c->tw = 0;
|
c->tw = textw(c->name);
|
||||||
for(i = 0; i < ntags; i++)
|
|
||||||
if(c->tags[i])
|
|
||||||
c->tw += textw(tags[i]);
|
|
||||||
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;
|
||||||
c->tx = c->x + c->w - c->tw + 2;
|
c->tx = c->x + c->w - c->tw + 2;
|
||||||
c->ty = c->y;
|
c->ty = c->y;
|
||||||
if(isvisible(c))
|
if(isvisible(c))
|
||||||
XMoveResizeWindow(dpy, c->title, c->tx, c->ty, c->tw, c->th);
|
XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th);
|
||||||
else
|
else
|
||||||
XMoveResizeWindow(dpy, c->title, c->tx + 2 * sw, c->ty, c->tw, c->th);
|
XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +61,7 @@ void
|
|||||||
ban(Client *c)
|
ban(Client *c)
|
||||||
{
|
{
|
||||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
||||||
XMoveWindow(dpy, c->title, c->tx + 2 * sw, c->ty);
|
XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -106,7 +102,7 @@ getctitle(Window w)
|
|||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(c = clients; c; c = c->next)
|
for(c = clients; c; c = c->next)
|
||||||
if(c->title == w)
|
if(c->twin == w)
|
||||||
return c;
|
return c;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -214,7 +210,7 @@ manage(Window w, XWindowAttributes *wa)
|
|||||||
twa.background_pixmap = ParentRelative;
|
twa.background_pixmap = ParentRelative;
|
||||||
twa.event_mask = ExposureMask | EnterWindowMask;
|
twa.event_mask = ExposureMask | EnterWindowMask;
|
||||||
|
|
||||||
c->title = 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);
|
||||||
@ -242,7 +238,7 @@ manage(Window w, XWindowAttributes *wa)
|
|||||||
sel = c;
|
sel = c;
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
XMapWindow(dpy, c->win);
|
XMapWindow(dpy, c->win);
|
||||||
XMapWindow(dpy, c->title);
|
XMapWindow(dpy, c->twin);
|
||||||
if(isvisible(c))
|
if(isvisible(c))
|
||||||
focus(c);
|
focus(c);
|
||||||
}
|
}
|
||||||
@ -329,7 +325,7 @@ void
|
|||||||
settitle(Client *c)
|
settitle(Client *c)
|
||||||
{
|
{
|
||||||
char **list = NULL;
|
char **list = NULL;
|
||||||
int n;
|
int i, n;
|
||||||
XTextProperty name;
|
XTextProperty name;
|
||||||
|
|
||||||
name.nitems = 0;
|
name.nitems = 0;
|
||||||
@ -392,7 +388,7 @@ unmanage(Client *c)
|
|||||||
XSetErrorHandler(xerrordummy);
|
XSetErrorHandler(xerrordummy);
|
||||||
|
|
||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||||
XDestroyWindow(dpy, c->title);
|
XDestroyWindow(dpy, c->twin);
|
||||||
|
|
||||||
if(c->prev)
|
if(c->prev)
|
||||||
c->prev->next = c->next;
|
c->prev->next = c->next;
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
const char *tags[] = { "work", "net", "fnord", NULL };
|
const char *tags[] = { "work", "net", "fnord", NULL };
|
||||||
|
|
||||||
#define DEFMODE dotile /* dofloat */
|
#define DEFMODE dotile /* dofloat */
|
||||||
#define TFONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*"
|
#define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*"
|
||||||
#define FONT "-*-snap-*-*-*-*-*-*-*-*-*-*-*-*"
|
|
||||||
#define BGCOLOR "#0d121d"
|
#define BGCOLOR "#0d121d"
|
||||||
#define FGCOLOR "#eeeeee"
|
#define FGCOLOR "#eeeeee"
|
||||||
#define BORDERCOLOR "#3f484d"
|
#define BORDERCOLOR "#3f484d"
|
||||||
@ -19,7 +18,7 @@ const char *tags[] = { "work", "net", "fnord", NULL };
|
|||||||
static Key key[] = { \
|
static Key key[] = { \
|
||||||
/* modifier key function arguments */ \
|
/* modifier key function arguments */ \
|
||||||
{ MODKEY|ShiftMask, XK_Return, spawn, \
|
{ MODKEY|ShiftMask, XK_Return, spawn, \
|
||||||
{ .cmd = "exec uxterm +sb -bg black -fg '#eeeeee' -fn '"TFONT"'" } }, \
|
{ .cmd = "exec uxterm +sb -bg black -fg '#eeeeee' -fn '"FONT"'" } }, \
|
||||||
{ MODKEY, XK_p, spawn, \
|
{ MODKEY, XK_p, spawn, \
|
||||||
{ .cmd = "exec `ls -lL /usr/bin /usr/X11R6/bin /usr/local/bin 2>/dev/null | " \
|
{ .cmd = "exec `ls -lL /usr/bin /usr/X11R6/bin /usr/local/bin 2>/dev/null | " \
|
||||||
"awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort -u | dmenu`" } }, \
|
"awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort -u | dmenu`" } }, \
|
||||||
|
94
draw.c
94
draw.c
@ -22,19 +22,9 @@ textnw(const char *text, unsigned int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
drawtext(const char *text, Bool invert)
|
drawborder()
|
||||||
{
|
{
|
||||||
int x, y, w, h;
|
|
||||||
static char buf[256];
|
|
||||||
unsigned int len, olen;
|
|
||||||
XGCValues gcv;
|
|
||||||
XPoint points[5];
|
XPoint points[5];
|
||||||
XRectangle r = { dc.x, dc.y, dc.w, dc.h };
|
|
||||||
|
|
||||||
XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg);
|
|
||||||
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
|
||||||
XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
|
|
||||||
XSetForeground(dpy, dc.gc, dc.border);
|
|
||||||
points[0].x = dc.x;
|
points[0].x = dc.x;
|
||||||
points[0].y = dc.y;
|
points[0].y = dc.y;
|
||||||
points[1].x = dc.w - 1;
|
points[1].x = dc.w - 1;
|
||||||
@ -46,6 +36,23 @@ drawtext(const char *text, Bool invert)
|
|||||||
points[4].x = 0;
|
points[4].x = 0;
|
||||||
points[4].y = -(dc.h - 1);
|
points[4].y = -(dc.h - 1);
|
||||||
XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
|
XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
drawtext(const char *text, Bool invert, Bool highlight)
|
||||||
|
{
|
||||||
|
int x, y, w, h;
|
||||||
|
static char buf[256];
|
||||||
|
unsigned int len, olen;
|
||||||
|
DC tmp;
|
||||||
|
XGCValues gcv;
|
||||||
|
XRectangle r = { dc.x, dc.y, dc.w, dc.h };
|
||||||
|
|
||||||
|
XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg);
|
||||||
|
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
||||||
|
XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
|
XSetForeground(dpy, dc.gc, dc.border);
|
||||||
|
drawborder();
|
||||||
|
|
||||||
if(!text)
|
if(!text)
|
||||||
return;
|
return;
|
||||||
@ -75,18 +82,25 @@ drawtext(const char *text, Bool invert)
|
|||||||
|
|
||||||
if(w > dc.w)
|
if(w > dc.w)
|
||||||
return; /* too long */
|
return; /* too long */
|
||||||
|
|
||||||
gcv.foreground = invert ? dc.bg : dc.fg;
|
gcv.foreground = invert ? dc.bg : dc.fg;
|
||||||
gcv.background = invert ? dc.fg : dc.bg;
|
gcv.background = invert ? dc.fg : dc.bg;
|
||||||
if(dc.font.set) {
|
if(dc.font.set) {
|
||||||
XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv);
|
XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv);
|
||||||
XmbDrawImageString(dpy, dc.drawable, dc.font.set, dc.gc,
|
XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len);
|
||||||
x, y, buf, len);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gcv.font = dc.font.xfont->fid;
|
gcv.font = dc.font.xfont->fid;
|
||||||
XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv);
|
XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv);
|
||||||
XDrawImageString(dpy, dc.drawable, dc.gc, x, y, buf, len);
|
XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len);
|
||||||
|
}
|
||||||
|
if(highlight) {
|
||||||
|
tmp = dc;
|
||||||
|
dc.x += 2;
|
||||||
|
dc.y += 2;
|
||||||
|
dc.w -= 4;
|
||||||
|
dc.h -= 4;
|
||||||
|
drawborder();
|
||||||
|
dc = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,36 +124,29 @@ drawstatus()
|
|||||||
|
|
||||||
dc.x = dc.y = 0;
|
dc.x = dc.y = 0;
|
||||||
dc.w = bw;
|
dc.w = bw;
|
||||||
drawtext(NULL, !istile);
|
drawtext(NULL, !istile, False);
|
||||||
|
|
||||||
dc.w = 0;
|
dc.w = 0;
|
||||||
for(i = 0; i < ntags; i++) {
|
for(i = 0; i < ntags; i++) {
|
||||||
dc.x += dc.w;
|
dc.x += dc.w;
|
||||||
dc.w = textw(tags[i]);
|
dc.w = textw(tags[i]);
|
||||||
if(istile)
|
if(istile)
|
||||||
drawtext(tags[i], seltag[i]);
|
drawtext(tags[i], seltag[i], sel && sel->tags[i]);
|
||||||
else
|
else
|
||||||
drawtext(tags[i], !seltag[i]);
|
drawtext(tags[i], !seltag[i], sel && sel->tags[i]);
|
||||||
}
|
}
|
||||||
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;
|
||||||
drawtext(stext, !istile);
|
if(dc.x < x) {
|
||||||
|
dc.x = x;
|
||||||
|
dc.w = bw - x;
|
||||||
|
}
|
||||||
|
drawtext(stext, !istile, False);
|
||||||
|
|
||||||
if(sel) {
|
if(sel && ((dc.w = dc.x - x) > bh)) {
|
||||||
for(i = 0; i < ntags; i++)
|
dc.x = x;
|
||||||
if(sel->tags[i]) {
|
drawtext(sel->name, istile, False);
|
||||||
dc.w = textw(tags[i]);
|
|
||||||
dc.x -= dc.w;
|
|
||||||
if(dc.x < x)
|
|
||||||
break;
|
|
||||||
drawtext(tags[i], istile);
|
|
||||||
}
|
|
||||||
if(dc.x > x && (dc.x - x) > bh) {
|
|
||||||
dc.w = dc.x - x;
|
|
||||||
dc.x = x;
|
|
||||||
drawtext(sel->name, istile);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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);
|
||||||
@ -153,26 +160,17 @@ drawtitle(Client *c)
|
|||||||
|
|
||||||
if(c == sel && issel) {
|
if(c == sel && issel) {
|
||||||
drawstatus();
|
drawstatus();
|
||||||
XUnmapWindow(dpy, c->title);
|
XUnmapWindow(dpy, c->twin);
|
||||||
XSetWindowBorder(dpy, c->win, dc.fg);
|
XSetWindowBorder(dpy, c->win, dc.fg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
XSetWindowBorder(dpy, c->win, dc.bg);
|
XSetWindowBorder(dpy, c->win, dc.bg);
|
||||||
XMapWindow(dpy, c->title);
|
XMapWindow(dpy, c->twin);
|
||||||
|
dc.x = dc.y = 0;
|
||||||
dc.y = dc.w = 0;
|
dc.w = c->tw;
|
||||||
dc.x = c->tw;
|
drawtext(c->name, !istile, False);
|
||||||
for(i = 0; i < ntags; i++)
|
XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0);
|
||||||
if(c->tags[i]) {
|
|
||||||
dc.w = textw(tags[i]);
|
|
||||||
dc.x -= dc.w;
|
|
||||||
drawtext(tags[i], !istile);
|
|
||||||
}
|
|
||||||
dc.w = dc.x;
|
|
||||||
dc.x = 0;
|
|
||||||
drawtext(c->name, !istile);
|
|
||||||
XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0);
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
dwm.1
8
dwm.1
@ -21,12 +21,12 @@ tags. Selecting a certain tag for viewing will display all windows with that
|
|||||||
tag.
|
tag.
|
||||||
.P
|
.P
|
||||||
.B dwm
|
.B dwm
|
||||||
contains a small status bar which displays all available tags, the title and the
|
contains a small status bar which displays all available tags, the title
|
||||||
tags of the focused window, and the text read from standard input.
|
of the focused window, and the text read from standard input. The tags of the
|
||||||
|
focused window are highlighted.
|
||||||
.P
|
.P
|
||||||
.B dwm draws a 1-pixel border around windows to indicate the focus state.
|
.B 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.
|
||||||
and tags.
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
.B \-v
|
.B \-v
|
||||||
|
2
dwm.h
2
dwm.h
@ -60,7 +60,7 @@ struct Client {
|
|||||||
Client *next;
|
Client *next;
|
||||||
Client *prev;
|
Client *prev;
|
||||||
Window win;
|
Window win;
|
||||||
Window title;
|
Window twin;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const char *tags[];
|
extern const char *tags[];
|
||||||
|
2
tag.c
2
tag.c
@ -141,4 +141,6 @@ toggletag(Arg *arg)
|
|||||||
settitle(sel);
|
settitle(sel);
|
||||||
if(!isvisible(sel))
|
if(!isvisible(sel))
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
|
else
|
||||||
|
drawstatus();
|
||||||
}
|
}
|
||||||
|
8
view.c
8
view.c
@ -168,21 +168,21 @@ restack()
|
|||||||
fi = 0;
|
fi = 0;
|
||||||
mi = 2 * f;
|
mi = 2 * f;
|
||||||
if(sel->isfloat || arrange == dofloat) {
|
if(sel->isfloat || arrange == dofloat) {
|
||||||
wins[fi++] = sel->title;
|
wins[fi++] = sel->twin;
|
||||||
wins[fi++] = sel->win;
|
wins[fi++] = sel->win;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wins[mi++] = sel->title;
|
wins[mi++] = sel->twin;
|
||||||
wins[mi++] = sel->win;
|
wins[mi++] = sel->win;
|
||||||
}
|
}
|
||||||
for(c = clients; c; c = c->next)
|
for(c = clients; c; c = c->next)
|
||||||
if(isvisible(c) && c != sel) {
|
if(isvisible(c) && c != sel) {
|
||||||
if(c->isfloat || arrange == dofloat) {
|
if(c->isfloat || arrange == dofloat) {
|
||||||
wins[fi++] = c->title;
|
wins[fi++] = c->twin;
|
||||||
wins[fi++] = c->win;
|
wins[fi++] = c->win;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wins[mi++] = c->title;
|
wins[mi++] = c->twin;
|
||||||
wins[mi++] = c->win;
|
wins[mi++] = c->win;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user