comparison aewl.c @ 771:59a6f0ba5478

beautified status bar
author meillo@marmaro.de
date Sat, 06 Dec 2008 10:56:43 +0100
parents 33cec4282120
children 0c1e9952a278
comparison
equal deleted inserted replaced
770:33cec4282120 771:59a6f0ba5478
19 * set the override_redirect flag. Clients are organized in a global 19 * set the override_redirect flag. Clients are organized in a global
20 * doubly-linked client list, the focus history is remembered through a global 20 * doubly-linked client list, the focus history is remembered through a global
21 * stack list. [...] 21 * stack list. [...]
22 * 22 *
23 * Keys and tagging rules are organized as arrays and defined in the config.h 23 * Keys and tagging rules are organized as arrays and defined in the config.h
24 * file. These arrays are kept static in event.o and tag.o respectively, 24 * file. [...] The current mode is represented by the arrange() function
25 * because no other part of dwm needs access to them. The current mode is 25 * pointer, which wether points to [domax()] or dotile().
26 * represented by the arrange() function pointer, which wether points to
27 * domax() or dotile().
28 * 26 *
29 * To understand everything else, start reading main.c:main(). 27 * To understand everything else, start reading main.c:main().
30 * 28 *
31 * -- and now about aewl -- 29 * -- and now about aewl --
32 * 30 *
124 #define MOUSEMASK (BUTTONMASK | PointerMotionMask) 122 #define MOUSEMASK (BUTTONMASK | PointerMotionMask)
125 123
126 124
127 125
128 char stext[256]; /* status text */ 126 char stext[256]; /* status text */
129 int bh, bmw; /* bar height, bar mode label width */ 127 int bh; /* bar height */
130 int screen, sx, sy, sw, sh; /* screen geometry */ 128 int screen, sx, sy, sw, sh; /* screen geometry */
131 int wax, way, wah, waw; /* windowarea geometry */ 129 int wax, way, wah, waw; /* windowarea geometry */
132 unsigned int nmaster; /* number of master clients */ 130 unsigned int nmaster; /* number of master clients */
133 unsigned int numlockmask; /* dynamic lock mask */ 131 unsigned int numlockmask; /* dynamic lock mask */
134 void (*handler[LASTEvent])(XEvent *); /* event handler */ 132 void (*handler[LASTEvent])(XEvent *); /* event handler */
1005 1003
1006 1004
1007 void 1005 void
1008 drawstatus(void) { 1006 drawstatus(void) {
1009 int x; 1007 int x;
1010 1008 unsigned long black[ColLast];
1009 black[ColBG] = getcolor("#000000");
1010 black[ColFG] = getcolor("#ffffff");
1011
1012 /* views */
1011 dc.x = dc.y = 0; 1013 dc.x = dc.y = 0;
1012 dc.w = textw(NAMETAGGED); 1014 dc.w = textw(NAMETAGGED);
1013 drawtext(NAMETAGGED, ( seltag ? dc.sel : dc.norm )); 1015 drawtext(NAMETAGGED, ( seltag ? dc.sel : dc.norm ));
1014 dc.x += dc.w + 1; 1016
1017 dc.x += dc.w;
1018 dc.w = BORDERPX;
1019 drawtext(NULL, black);
1020
1021 dc.x += dc.w;
1015 dc.w = textw(NAMEUNTAGGED); 1022 dc.w = textw(NAMEUNTAGGED);
1016 drawtext(NAMEUNTAGGED, ( seltag ? dc.norm : dc.sel )); 1023 drawtext(NAMEUNTAGGED, ( seltag ? dc.norm : dc.sel ));
1017 dc.x += dc.w + 1; 1024
1018 dc.w = bmw; 1025 dc.x += dc.w;
1019 drawtext("", dc.norm); 1026 dc.w = BORDERPX;
1027 drawtext(NULL, black);
1028
1029 /* status text */
1020 x = dc.x + dc.w; 1030 x = dc.x + dc.w;
1021 dc.w = textw(stext); 1031 dc.w = textw(stext);
1022 dc.x = sw - dc.w; 1032 dc.x = sw - dc.w;
1023 if(dc.x < x) { 1033 if(dc.x < x) {
1024 dc.x = x; 1034 dc.x = x;
1025 dc.w = sw - x; 1035 dc.w = sw - x;
1026 } 1036 }
1027 drawtext(stext, dc.norm); 1037 drawtext(stext, dc.norm);
1038
1039 /* client title */
1028 if((dc.w = dc.x - x) > bh) { 1040 if((dc.w = dc.x - x) > bh) {
1029 dc.x = x; 1041 dc.x = x;
1030 drawtext(sel ? sel->name : NULL, dc.norm); 1042 drawtext(sel ? sel->name : NULL, dc.norm);
1031 } 1043
1044 dc.x += dc.w;
1045 dc.w = BORDERPX;
1046 drawtext(NULL, black);
1047 }
1048
1032 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, sw, bh, 0, 0); 1049 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, sw, bh, 0, 0);
1033 XSync(dpy, False); 1050 XSync(dpy, False);
1034 } 1051 }
1035 1052
1036 unsigned long 1053 unsigned long
1555 /* geometry */ 1572 /* geometry */
1556 sx = sy = 0; 1573 sx = sy = 0;
1557 sw = DisplayWidth(dpy, screen); 1574 sw = DisplayWidth(dpy, screen);
1558 sh = DisplayHeight(dpy, screen); 1575 sh = DisplayHeight(dpy, screen);
1559 nmaster = NMASTER; 1576 nmaster = NMASTER;
1560 bmw = 1;
1561 /* bar */ 1577 /* bar */
1562 dc.h = bh = dc.font.height + 2; 1578 dc.h = bh = dc.font.height + 2;
1563 wa.override_redirect = 1; 1579 wa.override_redirect = 1;
1564 wa.background_pixmap = ParentRelative; 1580 wa.background_pixmap = ParentRelative;
1565 wa.event_mask = ButtonPressMask | ExposureMask; 1581 wa.event_mask = ButtonPressMask | ExposureMask;