updated man page
7e597ae2
7 file(s) · +68 −73
| 28 | 28 | { |
|
| 29 | 29 | int i; |
|
| 30 | 30 | ||
| 31 | - | c->tw = 0; |
|
| 32 | - | for(i = 0; i < ntags; i++) |
|
| 33 | - | if(c->tags[i]) |
|
| 34 | - | c->tw += textw(tags[i]); |
|
| 35 | - | c->tw += textw(c->name); |
|
| 31 | + | c->tw = textw(c->name); |
|
| 36 | 32 | if(c->tw > c->w) |
|
| 37 | 33 | c->tw = c->w + 2; |
|
| 38 | 34 | c->tx = c->x + c->w - c->tw + 2; |
|
| 39 | 35 | c->ty = c->y; |
|
| 40 | 36 | if(isvisible(c)) |
|
| 41 | - | XMoveResizeWindow(dpy, c->title, c->tx, c->ty, c->tw, c->th); |
|
| 37 | + | XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th); |
|
| 42 | 38 | else |
|
| 43 | - | XMoveResizeWindow(dpy, c->title, c->tx + 2 * sw, c->ty, c->tw, c->th); |
|
| 39 | + | XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th); |
|
| 44 | 40 | ||
| 45 | 41 | } |
|
| 46 | 42 | ||
| 65 | 61 | ban(Client *c) |
|
| 66 | 62 | { |
|
| 67 | 63 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
|
| 68 | - | XMoveWindow(dpy, c->title, c->tx + 2 * sw, c->ty); |
|
| 64 | + | XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty); |
|
| 69 | 65 | } |
|
| 70 | 66 | ||
| 71 | 67 | void |
|
| 106 | 102 | Client *c; |
|
| 107 | 103 | ||
| 108 | 104 | for(c = clients; c; c = c->next) |
|
| 109 | - | if(c->title == w) |
|
| 105 | + | if(c->twin == w) |
|
| 110 | 106 | return c; |
|
| 111 | 107 | return NULL; |
|
| 112 | 108 | } |
|
| 214 | 210 | twa.background_pixmap = ParentRelative; |
|
| 215 | 211 | twa.event_mask = ExposureMask | EnterWindowMask; |
|
| 216 | 212 | ||
| 217 | - | c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, |
|
| 213 | + | c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, |
|
| 218 | 214 | 0, DefaultDepth(dpy, screen), CopyFromParent, |
|
| 219 | 215 | DefaultVisual(dpy, screen), |
|
| 220 | 216 | CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); |
|
| 242 | 238 | sel = c; |
|
| 243 | 239 | arrange(NULL); |
|
| 244 | 240 | XMapWindow(dpy, c->win); |
|
| 245 | - | XMapWindow(dpy, c->title); |
|
| 241 | + | XMapWindow(dpy, c->twin); |
|
| 246 | 242 | if(isvisible(c)) |
|
| 247 | 243 | focus(c); |
|
| 248 | 244 | } |
|
| 329 | 325 | settitle(Client *c) |
|
| 330 | 326 | { |
|
| 331 | 327 | char **list = NULL; |
|
| 332 | - | int n; |
|
| 328 | + | int i, n; |
|
| 333 | 329 | XTextProperty name; |
|
| 334 | 330 | ||
| 335 | 331 | name.nitems = 0; |
|
| 392 | 388 | XSetErrorHandler(xerrordummy); |
|
| 393 | 389 | ||
| 394 | 390 | XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
|
| 395 | - | XDestroyWindow(dpy, c->title); |
|
| 391 | + | XDestroyWindow(dpy, c->twin); |
|
| 396 | 392 | ||
| 397 | 393 | if(c->prev) |
|
| 398 | 394 | c->prev->next = c->next; |
|
| 7 | 7 | const char *tags[] = { "work", "net", "fnord", NULL }; |
|
| 8 | 8 | ||
| 9 | 9 | #define DEFMODE dotile /* dofloat */ |
|
| 10 | - | #define TFONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*" |
|
| 11 | - | #define FONT "-*-snap-*-*-*-*-*-*-*-*-*-*-*-*" |
|
| 10 | + | #define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*" |
|
| 12 | 11 | #define BGCOLOR "#0d121d" |
|
| 13 | 12 | #define FGCOLOR "#eeeeee" |
|
| 14 | 13 | #define BORDERCOLOR "#3f484d" |
|
| 19 | 18 | static Key key[] = { \ |
|
| 20 | 19 | /* modifier key function arguments */ \ |
|
| 21 | 20 | { MODKEY|ShiftMask, XK_Return, spawn, \ |
|
| 22 | - | { .cmd = "exec uxterm +sb -bg black -fg '#eeeeee' -fn '"TFONT"'" } }, \ |
|
| 21 | + | { .cmd = "exec uxterm +sb -bg black -fg '#eeeeee' -fn '"FONT"'" } }, \ |
|
| 23 | 22 | { MODKEY, XK_p, spawn, \ |
|
| 24 | 23 | { .cmd = "exec `ls -lL /usr/bin /usr/X11R6/bin /usr/local/bin 2>/dev/null | " \ |
|
| 25 | 24 | "awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort -u | dmenu`" } }, \ |
|
| 22 | 22 | } |
|
| 23 | 23 | ||
| 24 | 24 | static void |
|
| 25 | - | drawtext(const char *text, Bool invert) |
|
| 25 | + | drawborder() |
|
| 26 | 26 | { |
|
| 27 | - | int x, y, w, h; |
|
| 28 | - | static char buf[256]; |
|
| 29 | - | unsigned int len, olen; |
|
| 30 | - | XGCValues gcv; |
|
| 31 | 27 | XPoint points[5]; |
|
| 32 | - | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
|
| 33 | - | ||
| 34 | - | XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); |
|
| 35 | - | XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
|
| 36 | - | XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
|
| 37 | - | XSetForeground(dpy, dc.gc, dc.border); |
|
| 38 | 28 | points[0].x = dc.x; |
|
| 39 | 29 | points[0].y = dc.y; |
|
| 40 | 30 | points[1].x = dc.w - 1; |
|
| 46 | 36 | points[4].x = 0; |
|
| 47 | 37 | points[4].y = -(dc.h - 1); |
|
| 48 | 38 | XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious); |
|
| 39 | + | } |
|
| 40 | + | ||
| 41 | + | static void |
|
| 42 | + | drawtext(const char *text, Bool invert, Bool highlight) |
|
| 43 | + | { |
|
| 44 | + | int x, y, w, h; |
|
| 45 | + | static char buf[256]; |
|
| 46 | + | unsigned int len, olen; |
|
| 47 | + | DC tmp; |
|
| 48 | + | XGCValues gcv; |
|
| 49 | + | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
|
| 50 | + | ||
| 51 | + | XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); |
|
| 52 | + | XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
|
| 53 | + | XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
|
| 54 | + | XSetForeground(dpy, dc.gc, dc.border); |
|
| 55 | + | drawborder(); |
|
| 49 | 56 | ||
| 50 | 57 | if(!text) |
|
| 51 | 58 | return; |
|
| 75 | 82 | ||
| 76 | 83 | if(w > dc.w) |
|
| 77 | 84 | return; /* too long */ |
|
| 78 | - | ||
| 79 | 85 | gcv.foreground = invert ? dc.bg : dc.fg; |
|
| 80 | 86 | gcv.background = invert ? dc.fg : dc.bg; |
|
| 81 | 87 | if(dc.font.set) { |
|
| 82 | 88 | XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv); |
|
| 83 | - | XmbDrawImageString(dpy, dc.drawable, dc.font.set, dc.gc, |
|
| 84 | - | x, y, buf, len); |
|
| 89 | + | XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len); |
|
| 85 | 90 | } |
|
| 86 | 91 | else { |
|
| 87 | 92 | gcv.font = dc.font.xfont->fid; |
|
| 88 | 93 | XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv); |
|
| 89 | - | XDrawImageString(dpy, dc.drawable, dc.gc, x, y, buf, len); |
|
| 94 | + | XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); |
|
| 95 | + | } |
|
| 96 | + | if(highlight) { |
|
| 97 | + | tmp = dc; |
|
| 98 | + | dc.x += 2; |
|
| 99 | + | dc.y += 2; |
|
| 100 | + | dc.w -= 4; |
|
| 101 | + | dc.h -= 4; |
|
| 102 | + | drawborder(); |
|
| 103 | + | dc = tmp; |
|
| 90 | 104 | } |
|
| 91 | 105 | } |
|
| 92 | 106 | ||
| 110 | 124 | ||
| 111 | 125 | dc.x = dc.y = 0; |
|
| 112 | 126 | dc.w = bw; |
|
| 113 | - | drawtext(NULL, !istile); |
|
| 127 | + | drawtext(NULL, !istile, False); |
|
| 114 | 128 | ||
| 115 | 129 | dc.w = 0; |
|
| 116 | 130 | for(i = 0; i < ntags; i++) { |
|
| 117 | 131 | dc.x += dc.w; |
|
| 118 | 132 | dc.w = textw(tags[i]); |
|
| 119 | 133 | if(istile) |
|
| 120 | - | drawtext(tags[i], seltag[i]); |
|
| 134 | + | drawtext(tags[i], seltag[i], sel && sel->tags[i]); |
|
| 121 | 135 | else |
|
| 122 | - | drawtext(tags[i], !seltag[i]); |
|
| 136 | + | drawtext(tags[i], !seltag[i], sel && sel->tags[i]); |
|
| 123 | 137 | } |
|
| 124 | 138 | x = dc.x + dc.w; |
|
| 125 | 139 | dc.w = textw(stext); |
|
| 126 | 140 | dc.x = bx + bw - dc.w; |
|
| 127 | - | drawtext(stext, !istile); |
|
| 141 | + | if(dc.x < x) { |
|
| 142 | + | dc.x = x; |
|
| 143 | + | dc.w = bw - x; |
|
| 144 | + | } |
|
| 145 | + | drawtext(stext, !istile, False); |
|
| 128 | 146 | ||
| 129 | - | if(sel) { |
|
| 130 | - | for(i = 0; i < ntags; i++) |
|
| 131 | - | if(sel->tags[i]) { |
|
| 132 | - | dc.w = textw(tags[i]); |
|
| 133 | - | dc.x -= dc.w; |
|
| 134 | - | if(dc.x < x) |
|
| 135 | - | break; |
|
| 136 | - | drawtext(tags[i], istile); |
|
| 137 | - | } |
|
| 138 | - | if(dc.x > x && (dc.x - x) > bh) { |
|
| 139 | - | dc.w = dc.x - x; |
|
| 140 | - | dc.x = x; |
|
| 141 | - | drawtext(sel->name, istile); |
|
| 142 | - | } |
|
| 147 | + | if(sel && ((dc.w = dc.x - x) > bh)) { |
|
| 148 | + | dc.x = x; |
|
| 149 | + | drawtext(sel->name, istile, False); |
|
| 143 | 150 | } |
|
| 144 | 151 | XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); |
|
| 145 | 152 | XSync(dpy, False); |
|
| 153 | 160 | ||
| 154 | 161 | if(c == sel && issel) { |
|
| 155 | 162 | drawstatus(); |
|
| 156 | - | XUnmapWindow(dpy, c->title); |
|
| 163 | + | XUnmapWindow(dpy, c->twin); |
|
| 157 | 164 | XSetWindowBorder(dpy, c->win, dc.fg); |
|
| 158 | 165 | return; |
|
| 159 | 166 | } |
|
| 160 | 167 | ||
| 161 | 168 | XSetWindowBorder(dpy, c->win, dc.bg); |
|
| 162 | - | XMapWindow(dpy, c->title); |
|
| 163 | - | ||
| 164 | - | dc.y = dc.w = 0; |
|
| 165 | - | dc.x = c->tw; |
|
| 166 | - | for(i = 0; i < ntags; i++) |
|
| 167 | - | if(c->tags[i]) { |
|
| 168 | - | dc.w = textw(tags[i]); |
|
| 169 | - | dc.x -= dc.w; |
|
| 170 | - | drawtext(tags[i], !istile); |
|
| 171 | - | } |
|
| 172 | - | dc.w = dc.x; |
|
| 173 | - | dc.x = 0; |
|
| 174 | - | drawtext(c->name, !istile); |
|
| 175 | - | XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0); |
|
| 169 | + | XMapWindow(dpy, c->twin); |
|
| 170 | + | dc.x = dc.y = 0; |
|
| 171 | + | dc.w = c->tw; |
|
| 172 | + | drawtext(c->name, !istile, False); |
|
| 173 | + | XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0); |
|
| 176 | 174 | XSync(dpy, False); |
|
| 177 | 175 | } |
|
| 178 | 176 | ||
| 21 | 21 | tag. |
|
| 22 | 22 | .P |
|
| 23 | 23 | .B dwm |
|
| 24 | - | contains a small status bar which displays all available tags, the title and the |
|
| 25 | - | tags of the focused window, and the text read from standard input. |
|
| 24 | + | contains a small status bar which displays all available tags, the title |
|
| 25 | + | of the focused window, and the text read from standard input. The tags of the |
|
| 26 | + | focused window are highlighted. |
|
| 26 | 27 | .P |
|
| 27 | 28 | .B dwm draws a 1-pixel border around windows to indicate the focus state. |
|
| 28 | - | Unfocused windows contain a small bar in front of them displaying their title |
|
| 29 | - | and tags. |
|
| 29 | + | Unfocused windows contain a small bar in front of them displaying their title. |
|
| 30 | 30 | .SH OPTIONS |
|
| 31 | 31 | .TP |
|
| 32 | 32 | .B \-v |
| 60 | 60 | Client *next; |
|
| 61 | 61 | Client *prev; |
|
| 62 | 62 | Window win; |
|
| 63 | - | Window title; |
|
| 63 | + | Window twin; |
|
| 64 | 64 | }; |
|
| 65 | 65 | ||
| 66 | 66 | extern const char *tags[]; |
| 141 | 141 | settitle(sel); |
|
| 142 | 142 | if(!isvisible(sel)) |
|
| 143 | 143 | arrange(NULL); |
|
| 144 | + | else |
|
| 145 | + | drawstatus(); |
|
| 144 | 146 | } |
| 168 | 168 | fi = 0; |
|
| 169 | 169 | mi = 2 * f; |
|
| 170 | 170 | if(sel->isfloat || arrange == dofloat) { |
|
| 171 | - | wins[fi++] = sel->title; |
|
| 171 | + | wins[fi++] = sel->twin; |
|
| 172 | 172 | wins[fi++] = sel->win; |
|
| 173 | 173 | } |
|
| 174 | 174 | else { |
|
| 175 | - | wins[mi++] = sel->title; |
|
| 175 | + | wins[mi++] = sel->twin; |
|
| 176 | 176 | wins[mi++] = sel->win; |
|
| 177 | 177 | } |
|
| 178 | 178 | for(c = clients; c; c = c->next) |
|
| 179 | 179 | if(isvisible(c) && c != sel) { |
|
| 180 | 180 | if(c->isfloat || arrange == dofloat) { |
|
| 181 | - | wins[fi++] = c->title; |
|
| 181 | + | wins[fi++] = c->twin; |
|
| 182 | 182 | wins[fi++] = c->win; |
|
| 183 | 183 | } |
|
| 184 | 184 | else { |
|
| 185 | - | wins[mi++] = c->title; |
|
| 185 | + | wins[mi++] = c->twin; |
|
| 186 | 186 | wins[mi++] = c->win; |
|
| 187 | 187 | } |
|
| 188 | 188 | } |