bar_indicators.c (3667B)
1 /* Indicator properties, you can override these in your config.h if you want. */ 2 #ifndef TAGSINDICATOR 3 #define TAGSINDICATOR 1 // 0 = off, 1 = on if >1 client/view tag, 2 = always on 4 #endif 5 #ifndef TAGSPX 6 #define TAGSPX 5 // # pixels for tag grid boxes 7 #endif 8 #ifndef TAGSROWS 9 #define TAGSROWS 3 // # rows in tag grid (9 tags, e.g. 3x3) 10 #endif 11 12 void 13 drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int y, int w, int h, unsigned int tag, int filled, int invert, int type) 14 { 15 int i, boxw, boxs, indn = 0; 16 if (!(occ & 1 << tag) || type == INDICATOR_NONE) 17 return; 18 19 boxs = drw->fonts->h / 9; 20 boxw = drw->fonts->h / 6 + 2; 21 if (filled == -1) 22 filled = m == selmon && m->sel && m->sel->tags & 1 << tag; 23 24 switch (type) { 25 default: 26 case INDICATOR_TOP_LEFT_SQUARE: 27 drw_rect(drw, x + boxs, y + boxs, boxw, boxw, filled, invert); 28 break; 29 case INDICATOR_TOP_LEFT_LARGER_SQUARE: 30 drw_rect(drw, x + boxs + 2, y + boxs+1, boxw+1, boxw+1, filled, invert); 31 break; 32 case INDICATOR_TOP_BAR: 33 drw_rect(drw, x + boxw, y, w - ( 2 * boxw + 1), boxw/2, filled, invert); 34 break; 35 case INDICATOR_TOP_BAR_SLIM: 36 drw_rect(drw, x + boxw, y, w - ( 2 * boxw + 1), 1, 0, invert); 37 break; 38 case INDICATOR_BOTTOM_BAR: 39 drw_rect(drw, x + boxw, y + h - boxw/2, w - ( 2 * boxw + 1), boxw/2, filled, invert); 40 break; 41 case INDICATOR_BOTTOM_BAR_SLIM: 42 drw_rect(drw, x + boxw, y + h - 1, w - ( 2 * boxw + 1), 1, 0, invert); 43 break; 44 case INDICATOR_BOX: 45 drw_rect(drw, x + boxw, y, w - 2 * boxw, h, 0, invert); 46 break; 47 case INDICATOR_BOX_WIDER: 48 drw_rect(drw, x + boxw/2, y, w - boxw, h, 0, invert); 49 break; 50 case INDICATOR_BOX_FULL: 51 drw_rect(drw, x, y, w - 2, h, 0, invert); 52 break; 53 case INDICATOR_CLIENT_DOTS: 54 for (c = m->clients; c; c = c->next) { 55 if (c->tags & (1 << tag)) { 56 drw_rect(drw, x, 1 + (indn * 2), m->sel == c ? 6 : 1, 1, 1, invert); 57 indn++; 58 } 59 if (h <= 1 + (indn * 2)) { 60 indn = 0; 61 x += 2; 62 } 63 } 64 break; 65 case INDICATOR_RIGHT_TAGS: 66 if (!c) 67 break; 68 for (i = 0; i < NUMTAGS; i++) { 69 drw_rect(drw, 70 ( x + w - 2 - ((NUMTAGS / TAGSROWS) * TAGSPX) 71 - (i % (NUMTAGS/TAGSROWS)) + ((i % (NUMTAGS / TAGSROWS)) * TAGSPX) 72 ), 73 ( y + 2 + ((i / (NUMTAGS/TAGSROWS)) * TAGSPX) 74 - ((i / (NUMTAGS/TAGSROWS))) 75 ), 76 TAGSPX, TAGSPX, (c->tags >> i) & 1, 0 77 ); 78 } 79 break; 80 case INDICATOR_PLUS_AND_LARGER_SQUARE: 81 boxs += 2; 82 boxw += 2; 83 /* falls through */ 84 case INDICATOR_PLUS_AND_SQUARE: 85 drw_rect(drw, x + boxs, y + boxs, boxw % 2 ? boxw : boxw + 1, boxw % 2 ? boxw : boxw + 1, filled, invert); 86 /* falls through */ 87 case INDICATOR_PLUS: 88 if (!(boxw % 2)) 89 boxw += 1; 90 drw_rect(drw, x + boxs + boxw / 2, y + boxs, 1, boxw, filled, invert); // | 91 drw_rect(drw, x + boxs, y + boxs + boxw / 2, boxw + 1, 1, filled, invert); // ‒ 92 break; 93 } 94 } 95 96 void 97 drawstateindicator(Monitor *m, Client *c, unsigned int occ, int x, int y, int w, int h, unsigned int tag, int filled, int invert) 98 { 99 #if FAKEFULLSCREEN_CLIENT_PATCH && !FAKEFULLSCREEN_PATCH 100 if (c->fakefullscreen && c->isfloating) 101 drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, floatfakefsindicatortype); 102 else if (c->fakefullscreen) 103 drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, fakefsindicatortype); 104 else 105 #endif // FAKEFULLSCREEN_CLIENT_PATCH 106 if (c->isfloating) 107 drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, floatindicatortype); 108 else 109 drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, tiledindicatortype); 110 #if ALWAYSONTOP_PATCH 111 if (c->isfloating && c->alwaysontop) 112 drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, aotindicatortype); 113 #endif // ALWAYSONTOP_PATCH 114 } 115