Cross-platform C++ library to copy/paste clipboard content
Cross-platform C++ library to copy/paste clipboard content
Copyright (c) 2015-2026 David Capello Library to copy/retrieve content to/from the clipboard/pasteboard.
Available features on Windows, macOS, and Linux (X11):
#include "clip.h"
#include
int main() {
clip::set_text("Hello World");
std::string value;
clip::get_text(value);
std::cout << value << "\n";
}#include "clip.h"
int main() {
clip::format my_format =
clip::register_format("com.appname.FormatName");
int value = 32;
std::string str = "Alternative text for value 32";
clip::lock l;
l.clear();
l.set_data(clip::text_format(), str.c_str(), str.size());
l.set_data(my_format, (const char*)&value, sizeof(int));
}size_t) in your custom
format data.libx11-dev/libX11-devel package.libpng-dev/libpng-devel package.CLIP_ENABLE_IMAGE: Enables the support to
copy/paste images.CLIP_ENABLE_LIST_FORMATS (only for Windows): Enables the
clip::lock::list_formats() API function and the
list_clip_formats example.CLIP_EXAMPLES: Compile examples.CLIP_TESTS: Compile tests.CLIP_INSTALL: Generate installation rules for CMake.CLIP_X11_WITH_PNG (only for Linux/X11): Enables support to
copy/paste images using the libpng library on Linux.Check the wiki
to know what projects are using the clip library.
No open issues yet, or sync has not completed.