• Stars
    star
    611
  • Rank 73,401 (Top 2 %)
  • Language
    C++
  • License
    MIT License
  • Created over 9 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cross-platform C++ library to copy/paste clipboard content

Clip Library

Copyright (c) 2015-2023 David Capello

build MIT Licensed

Library to copy/retrieve content to/from the clipboard/pasteboard.

Features

Available features on Windows, macOS, and Linux (X11):

  • Copy/paste UTF-8 text.
  • Copy/paste user-defined data.
  • Copy/paste RGB/RGBA images. This library use non-premultiplied alpha RGB values.

Example

#include "clip.h"
#include <iostream>

int main() {
  clip::set_text("Hello World");

  std::string value;
  clip::get_text(value);
  std::cout << value << "\n";
}

User-defined clipboard formats

#include "clip.h"

int main() {
  clip::format my_format =
    clip::register_format("com.appname.FormatName");

  int value = 32;

  clip::lock l;
  l.clear();
  l.set_data(clip::text_format(), "Alternative text for value 32");
  l.set_data(my_format, &value, sizeof(int));
}

Platform specific details

  • If two versions of your application (32-bit and 64-bit) can run at at the same time, remember to avoid storing data types that could change depending on the platform (e.g. size_t) in your custom format data.
  • Windows:
  • Linux:
    • To be able to copy/paste on Linux you need libx11-dev/libX11-devel package.
    • To copy/paste images you will need libpng-dev/libpng-devel package.

Who is using this library?

Check the wiki to know what projects are using the clip library.

More Repositories

1

keyfreq

Track Emacs commands frequency
Emacs Lisp
320
star
2

vaca

C++ Win32 wrapper to develop GUI apps
C++
99
star
3

pocketcpp

Compile C++11 / C++14 / C++17 / C++20 snippets with Notepad++ and MinGW/gcc 9.2.0
Shell
82
star
4

observable

Observer pattern and signals/slots for C++11 projects
C++
73
star
5

undo

C++ library to implement non-linear undo/redo functionality
C++
58
star
6

export-aseprite-file

Little Aseprite script to export the data inside a .aseprite
Lua
26
star
7

libuv-cmake

Compile libuv using cmake
CMake
15
star
8

annotations.js

Convert your comments in noticeable annotations
JavaScript
15
star
9

QuickResize

A simple extension for Aseprite to resize the sprite quickly
Lua
11
star
10

tok

A minimalist C++ library to iterate through string tokens
C++
10
star
11

handy

Handy text editor
C++
9
star
12

tetrisqueen

A Tetris clon with Queen music
C
7
star
13

housefly

My Ludum Dare #23 entry
ActionScript
6
star
14

cpp-utils

C++ Utilities
C++
5
star
15

defenderofnothing

Defender Of Nothing - A clon of Defender, but like an anti-videogame (my entry for SpeedHack 2007)
C++
5
star
16

cppillr

No goals
C++
4
star
17

htmlex

A small HTML preprocesor
C
4
star
18

howfast

Template to microbenchmark C++ code
CMake
4
star
19

mingw-downloader

Batch file to download MinGW compiler (gcc 4.5)
Shell
4
star
20

donkeybolonkey

Donkey Bolonkey - A Rat Poker clone
C
4
star
21

raster

An experimental/work-in-progress C++17 library to use raw buffers as 2D images.
C++
3
star
22

format

Experimental C++11 type-safe sprintf like functionality
C++
3
star
23

visitlab

Compare performance of std::visit vs switch/case
C++
3
star
24

lab

Desechos radioactivos de cรณdigo โ˜ข๏ธ
C++
2
star
25

makehugefile

Create one or several files with gigabytes of pseudo-random data
Go
2
star
26

ergoprog

Keyboard shortcuts for programmers
Emacs Lisp
2
star
27

asecripts

Personal collection of Aseprite scripts for testing purposes
Lua
2
star
28

StartFullscreen

Start Aseprite in Full-Screen mode
Lua
2
star
29

ErgoSublime

A port of ErgoEmacs functionality to Sublime Text 2
Python
2
star
30

loseface

An open source face recognition project.
C++
2
star
31

dacap.github.io

Personal website
HTML
1
star
32

cpp-snippets

A collection of C++ snippets
C++
1
star
33

c-snippets

Ancient set of C files (2000~2001)
C
1
star
34

utf8lab

C++
1
star
35

ideas

Ideas sobre software, hardware y cualquier otra cosa
1
star
36

sublime-shrink-whitespaces

Plugin for Sublime Text 2 to remove blank lines and whitespaces
Python
1
star
37

onemoc

One Minute Of Colors - my Ludum Dare #27 entry (2013)
JavaScript
1
star
38

msvc-bug

C++
1
star
39

stopwatch

C++
1
star
40

GameTemplate

Template project to create new games with Flixel.
ActionScript
1
star
41

findinfiles

quick alternative to find | grep
Go
1
star