#include #include #include #include #include #include int main(int argc, char **argv) { Display *display; Window target; char *color_name; unsigned int width; XColor color; Colormap colormap; if (argc != 4) { char *name; name = strrchr(argv[0], '/'); name = name ? name+1 : argv[0]; fprintf(stderr, "usage: %s window-id color width\n", name); exit(1); } target = strtol(argv[1], NULL, 10); color_name = argv[2]; width = (unsigned int)atoi(argv[3]); if ((display = XOpenDisplay(NULL)) == NULL) { fprintf(stderr, "cannot open display\n"); exit(1); } colormap = DefaultColormap(display, DefaultScreen(display)); XAllocNamedColor(display, colormap, color_name, &color, &color); XSetWindowBorder(display, target, color.pixel); XSetWindowBorderWidth(display, target, width); XCloseDisplay(display); exit(0); }