Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
3.4 KiB

  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. void
  12. 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)
  13. {
  14. int i, boxw, boxs, indn = 0;
  15. if (!(occ & 1 << tag) || type == INDICATOR_NONE)
  16. return;
  17. boxs = drw->fonts->h / 9;
  18. boxw = drw->fonts->h / 6 + 2;
  19. if (filled == -1)
  20. filled = m == selmon && m->sel && m->sel->tags & 1 << tag;
  21. switch (type) {
  22. default:
  23. case INDICATOR_TOP_LEFT_SQUARE:
  24. drw_rect(drw, x + boxs, y + boxs, boxw, boxw, filled, invert);
  25. break;
  26. case INDICATOR_TOP_LEFT_LARGER_SQUARE:
  27. drw_rect(drw, x + boxs + 2, y + boxs+1, boxw+1, boxw+1, filled, invert);
  28. break;
  29. case INDICATOR_TOP_BAR:
  30. drw_rect(drw, x + boxw, y, w - ( 2 * boxw + 1), boxw/2, filled, invert);
  31. break;
  32. case INDICATOR_TOP_BAR_SLIM:
  33. drw_rect(drw, x + boxw, y, w - ( 2 * boxw + 1), 1, 0, invert);
  34. break;
  35. case INDICATOR_BOTTOM_BAR:
  36. drw_rect(drw, x + boxw, y + h - boxw/2, w - ( 2 * boxw + 1), boxw/2, filled, invert);
  37. break;
  38. case INDICATOR_BOTTOM_BAR_SLIM:
  39. drw_rect(drw, x + boxw, y + h - 1, w - ( 2 * boxw + 1), 1, 0, invert);
  40. break;
  41. case INDICATOR_BOX:
  42. drw_rect(drw, x + boxw, y, w - 2 * boxw, h, 0, invert);
  43. break;
  44. case INDICATOR_BOX_WIDER:
  45. drw_rect(drw, x + boxw/2, y, w - boxw, h, 0, invert);
  46. break;
  47. case INDICATOR_BOX_FULL:
  48. drw_rect(drw, x, y, w - 2, h, 0, invert);
  49. break;
  50. case INDICATOR_CLIENT_DOTS:
  51. for (c = m->clients; c; c = c->next) {
  52. if (c->tags & (1 << tag)) {
  53. drw_rect(drw, x, 1 + (indn * 2), m->sel == c ? 6 : 1, 1, 1, invert);
  54. indn++;
  55. }
  56. if (h <= 1 + (indn * 2)) {
  57. indn = 0;
  58. x += 2;
  59. }
  60. }
  61. break;
  62. case INDICATOR_RIGHT_TAGS:
  63. if (!c)
  64. break;
  65. for (i = 0; i < NUMTAGS; i++) {
  66. drw_rect(drw,
  67. ( x + w - 2 - ((NUMTAGS / TAGSROWS) * TAGSPX)
  68. - (i % (NUMTAGS/TAGSROWS)) + ((i % (NUMTAGS / TAGSROWS)) * TAGSPX)
  69. ),
  70. ( y + 2 + ((i / (NUMTAGS/TAGSROWS)) * TAGSPX)
  71. - ((i / (NUMTAGS/TAGSROWS)))
  72. ),
  73. TAGSPX, TAGSPX, (c->tags >> i) & 1, 0
  74. );
  75. }
  76. break;
  77. case INDICATOR_PLUS_AND_LARGER_SQUARE:
  78. boxs += 2;
  79. boxw += 2;
  80. /* falls through */
  81. case INDICATOR_PLUS_AND_SQUARE:
  82. drw_rect(drw, x + boxs, y + boxs, boxw % 2 ? boxw : boxw + 1, boxw % 2 ? boxw : boxw + 1, filled, invert);
  83. /* falls through */
  84. case INDICATOR_PLUS:
  85. if (!(boxw % 2))
  86. boxw += 1;
  87. drw_rect(drw, x + boxs + boxw / 2, y + boxs, 1, boxw, filled, invert); // |
  88. drw_rect(drw, x + boxs, y + boxs + boxw / 2, boxw + 1, 1, filled, invert); // ‒
  89. break;
  90. }
  91. }
  92. void
  93. drawstateindicator(Monitor *m, Client *c, unsigned int occ, int x, int y, int w, int h, unsigned int tag, int filled, int invert)
  94. {
  95. #if FAKEFULLSCREEN_CLIENT_PATCH
  96. if (c->fakefullscreen && c->isfloating)
  97. drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, floatfakefsindicatortype);
  98. else if (c->fakefullscreen)
  99. drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, fakefsindicatortype);
  100. else
  101. #endif // FAKEFULLSCREEN_CLIENT_PATCH
  102. if (c->isfloating)
  103. drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, floatindicatortype);
  104. else
  105. drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, tiledindicatortype);
  106. }