Created
July 19, 2011 16:05
-
-
Save jordansissel/1092909 to your computer and use it in GitHub Desktop.
libxdo and WM_CLASS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% ./a.out $WINDOWID | |
Items: 22 | |
Type: STRING | |
WM_CLASS[0]: terminator | |
WM_CLASS[1]: Terminator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <xdo.h> | |
#include <stdio.h> | |
#include <string.h> | |
int main(int argc, char **argv) { | |
Window id; | |
xdo_t *xdo = xdo_new(NULL); | |
char *prop; | |
long nitems; | |
Atom type; | |
int size; | |
if (argc != 2) { | |
printf("Usage: %s <windowid>\n", argv[0]); | |
return 1; | |
} | |
id = atol(argv[1]); | |
prop = xdo_getwinprop(xdo, id, XInternAtom(xdo->xdpy, "WM_CLASS", False), | |
&nitems, &type, &size); | |
printf("Items: %d\n", nitems); | |
printf("Type: %s\n", XGetAtomName(xdo->xdpy, type)); | |
int len; | |
int chars = nitems; | |
int index = 0; | |
while (chars > 0) { | |
printf("WM_CLASS[%d]: %s\n", index, prop); | |
len = strlen(prop) + 1; /* +1 for the null byte */ | |
prop += len; | |
chars -= len; | |
index += 1; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
xdo_getwinprop
>xdo_get_window_property_by_atom