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.

79 lines
1.7 KiB

  1. int
  2. width_awesomebar(Bar *bar, BarArg *a)
  3. {
  4. return a->w;
  5. }
  6. int
  7. draw_awesomebar(Bar *bar, BarArg *a)
  8. {
  9. int n = 0, scm, remainder = 0, tabw, pad;
  10. unsigned int i;
  11. #if BAR_TITLE_LEFT_PAD_PATCH && BAR_TITLE_RIGHT_PAD_PATCH
  12. int x = a->x + lrpad / 2, w = a->w - lrpad;
  13. #elif BAR_TITLE_LEFT_PAD_PATCH
  14. int x = a->x + lrpad / 2, w = a->w - lrpad / 2;
  15. #elif BAR_TITLE_RIGHT_PAD_PATCH
  16. int x = a->x, w = a->w - lrpad / 2;
  17. #else
  18. int x = a->x, w = a->w;
  19. #endif // BAR_TITLE_LEFT_PAD_PATCH | BAR_TITLE_RIGHT_PAD_PATCH
  20. Client *c;
  21. for (c = bar->mon->clients; c; c = c->next)
  22. if (ISVISIBLE(c))
  23. n++;
  24. if (n > 0) {
  25. remainder = w % n;
  26. tabw = w / n;
  27. for (i = 0, c = bar->mon->clients; c; c = c->next, i++) {
  28. if (!ISVISIBLE(c))
  29. continue;
  30. if (bar->mon->sel == c)
  31. scm = SchemeTitleSel;
  32. else if (HIDDEN(c))
  33. scm = SchemeHid;
  34. else
  35. scm = SchemeTitleNorm;
  36. pad = lrpad / 2;
  37. #if BAR_CENTEREDWINDOWNAME_PATCH
  38. if (TEXTW(c->name) < tabw)
  39. pad = (tabw - TEXTW(c->name) + lrpad) / 2;
  40. #endif // BAR_CENTEREDWINDOWNAME_PATCH
  41. drw_setscheme(drw, scheme[scm]);
  42. drw_text(drw, x, a->y, tabw + (i < remainder ? 1 : 0), a->h, pad, c->name, 0, False);
  43. drawstateindicator(c->mon, c, 1, x, a->y, tabw + (i < remainder ? 1 : 0), a->h, 0, 0, c->isfixed);
  44. x += tabw + (i < remainder ? 1 : 0);
  45. }
  46. }
  47. return n;
  48. }
  49. int
  50. click_awesomebar(Bar *bar, Arg *arg, BarArg *a)
  51. {
  52. int x = 0, n = 0;
  53. Client *c;
  54. for (c = bar->mon->clients; c; c = c->next)
  55. if (ISVISIBLE(c))
  56. n++;
  57. c = bar->mon->clients;
  58. do {
  59. if (!c || !ISVISIBLE(c))
  60. continue;
  61. else
  62. x += (1.0 / (double)n) * a->w;
  63. } while (c && a->x > x && (c = c->next));
  64. if (c) {
  65. arg->v = c;
  66. return ClkWinTitle;
  67. }
  68. return -1;
  69. }