Logo Search packages:      
Sourcecode: xdotool version File versions  Download package

int xdo_get_current_desktop ( const xdo_t xdo,
long *  desktop 
)

Get the current desktop. Uses _NET_CURRENT_DESKTOP of the EWMH spec.

Parameters:
desktop pointer to long where the current desktop number is stored.

Definition at line 482 of file xdo.c.

References xdo::xdpy.

                                                             {
  Atom type;
  int size;
  long nitems;
  unsigned char *data;
  Window root;

  Atom request;

  if (_xdo_ewmh_is_supported(xdo, "_NET_CURRENT_DESKTOP") == False) {
    fprintf(stderr,
            "Your windowmanager claims not to support _NET_CURRENT_DESKTOP, "
            "so the query for the current desktop was aborted.\n");
    return XDO_ERROR;
  }

  request = XInternAtom(xdo->xdpy, "_NET_CURRENT_DESKTOP", False);
  root = XDefaultRootWindow(xdo->xdpy);

  data = xdo_getwinprop(xdo, root, request, &nitems, &type, &size);

  if (nitems > 0) {
    *desktop = *((long*)data);
  } else {
    *desktop = -1;
  }
  free(data);

  return _is_success("XGetWindowProperty[_NET_CURRENT_DESKTOP]",
                     *desktop == -1);
}


Generated by  Doxygen 1.6.0   Back to index