How to copy to clipboard with X11?
Using the frameworks on OS X, I can use the following to copy a PNG to the pasteboard (in C — obviously I could use NSPasteboard with Cocoa): #include <ApplicationServices/ApplicationServices.h> int copyThatThing(void) { PasteboardRef clipboard; if (PasteboardCreate(kPasteboardClipboard, &clipboard) != noErr) { return -1; } if (PasteboardClear(clipboard) != noErr) { CFRelease(clipboard); return -1; } size_t len; char *pngbuf = createMyPNGBuffer(&len); /* Defined somewhere else */ if (pngbuf == NULL) { CFRelease(clipboard); return -1; } CFDataRef data = CFDataCreateWithBytesNoCopy