bar_ewmhtags.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. void
  2. setcurrentdesktop(void)
  3. {
  4. long data[] = { 0 };
  5. XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
  6. }
  7. void
  8. setdesktopnames(void)
  9. {
  10. int i;
  11. XTextProperty text;
  12. char *tags[NUMTAGS];
  13. for (i = 0; i < NUMTAGS; i++)
  14. tags[i] = tagicon(selmon, i);
  15. Xutf8TextListToTextProperty(dpy, tags, NUMTAGS, XUTF8StringStyle, &text);
  16. XSetTextProperty(dpy, root, &text, netatom[NetDesktopNames]);
  17. }
  18. void
  19. setfloatinghint(Client *c)
  20. {
  21. Atom target = XInternAtom(dpy, "_IS_FLOATING", 0);
  22. unsigned int floating[1] = {c->isfloating};
  23. XChangeProperty(dpy, c->win, target, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)floating, 1);
  24. }
  25. void
  26. setnumdesktops(void)
  27. {
  28. long data[] = { NUMTAGS };
  29. XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
  30. }
  31. void
  32. setviewport(void)
  33. {
  34. long data[] = { 0, 0 };
  35. XChangeProperty(dpy, root, netatom[NetDesktopViewport], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 2);
  36. }
  37. void
  38. updatecurrentdesktop(void)
  39. {
  40. long rawdata[] = { selmon->tagset[selmon->seltags] };
  41. int i = 0;
  42. while (*rawdata >> (i + 1)) {
  43. i++;
  44. }
  45. long data[] = { i };
  46. XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
  47. }