aewl

annotate bar.c @ 72:d0eb0bb63c40

I prefer the tiled/floating indicator on the right side
author Anselm R. Garbe <garbeam@wmii.de>
date Fri, 14 Jul 2006 18:59:25 +0200
parents 7681ef838201
children
rev   line source
garbeam@57 1 /*
garbeam@57 2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
garbeam@57 3 * See LICENSE file for license details.
garbeam@57 4 */
garbeam@57 5
garbeam@57 6 #include "dwm.h"
garbeam@57 7
garbeam@57 8 void
garbeam@58 9 barclick(XButtonPressedEvent *e)
garbeam@58 10 {
garbeam@58 11 int x = 0;
garbeam@58 12 Arg a;
garbeam@58 13 for(a.i = 0; a.i < TLast; a.i++) {
garbeam@58 14 x += textw(tags[a.i]) + dc.font.height;
garbeam@58 15 if(e->x < x) {
garbeam@58 16 view(&a);
garbeam@58 17 return;
garbeam@58 18 }
garbeam@58 19 }
garbeam@58 20 }
garbeam@58 21
garbeam@58 22 void
garbeam@57 23 draw_bar()
garbeam@57 24 {
garbeam@72 25 int i, modw;
garbeam@71 26 char *mode = arrange == tiling ? "#" : "~";
garbeam@71 27
garbeam@57 28 dc.x = dc.y = 0;
garbeam@57 29 dc.w = bw;
garbeam@66 30 drawtext(NULL, False, False);
garbeam@57 31
garbeam@72 32 modw = textw(mode) + dc.font.height;
garbeam@72 33 dc.w = 0;
garbeam@57 34 for(i = 0; i < TLast; i++) {
garbeam@57 35 dc.x += dc.w;
garbeam@57 36 dc.w = textw(tags[i]) + dc.font.height;
garbeam@66 37 drawtext(tags[i], i == tsel, True);
garbeam@57 38 }
garbeam@57 39 if(sel) {
garbeam@57 40 dc.x += dc.w;
garbeam@57 41 dc.w = textw(sel->name) + dc.font.height;
garbeam@66 42 drawtext(sel->name, True, True);
garbeam@57 43 }
garbeam@57 44 dc.w = textw(stext) + dc.font.height;
garbeam@72 45 dc.x = bx + bw - dc.w - modw;
garbeam@66 46 drawtext(stext, False, False);
garbeam@72 47
garbeam@72 48 dc.x = bx + bw - modw;
garbeam@72 49 dc.w = modw;
garbeam@72 50 drawtext(mode, True, True);
garbeam@72 51
garbeam@57 52 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
garbeam@57 53 XFlush(dpy);
garbeam@57 54 }