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.

50 lines
935 B

  1. /*
  2. * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
  3. * See LICENSE file for license details.
  4. */
  5. #include "dwm.h"
  6. void
  7. barclick(XButtonPressedEvent *e)
  8. {
  9. int x = 0;
  10. Arg a;
  11. for(a.i = 0; a.i < TLast; a.i++) {
  12. x += textw(tags[a.i]) + dc.font.height;
  13. if(e->x < x) {
  14. view(&a);
  15. return;
  16. }
  17. }
  18. }
  19. void
  20. draw_bar()
  21. {
  22. int i;
  23. char *mode = arrange == tiling ? "#" : "~";
  24. dc.x = dc.y = 0;
  25. dc.w = bw;
  26. drawtext(NULL, False, False);
  27. dc.w = textw(mode) + dc.font.height;
  28. drawtext(mode, True, True);
  29. for(i = 0; i < TLast; i++) {
  30. dc.x += dc.w;
  31. dc.w = textw(tags[i]) + dc.font.height;
  32. drawtext(tags[i], i == tsel, True);
  33. }
  34. if(sel) {
  35. dc.x += dc.w;
  36. dc.w = textw(sel->name) + dc.font.height;
  37. drawtext(sel->name, True, True);
  38. }
  39. dc.w = textw(stext) + dc.font.height;
  40. dc.x = bx + bw - dc.w;
  41. drawtext(stext, False, False);
  42. XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
  43. XFlush(dpy);
  44. }