Clipboard tool that monitor clipboard and support delay-rendering for any text editor in Windows
csclip can be run as one time executable or as server process that communicating via stdio.
Usage:
- Help
csclip help- Paste text (default) or any format from clipboard
csclip paste
csclip paste -f <text|html|any other clipboard format id>- Copy to clipboard
Just need to pipe input to
csclip copy.
echo 'Test' | csclip copyOr even better, you can using json and put multiple data format (or just one) to clipboard.
echo '[{"cf":"text", "data":"test"}, {"cf":"html", "data":"<b>text in bold</b>"}]' | csclip copyThis will put test as text format to clipboard and put <b>text in bold</b> as html format to clipboard at the same time.
To know more about clipboard refer to this article
In this mode, csclip will communicate with client process (normally text editor) via stdio.
Client process should watch csclip stdout for notification.
Both side will communicating via JsonRPC
csclip serverWhen running as a server, csclip will monitor clipboard changes and notify the client about newly copied text.
This way, newly copied text will always be available on the client, and can be pasted without querying the clipboard again.
Notification paste:
{"method":"paste", "params":["<copied string>"]}Client can proactively getting text from clipboard by sending get request.
{"method":"get", "params":["<data format>"]}csclip will response with
{"result":"<requested data>"}Client can sent copy notification to csclip to notify which data should be copied to clipboard.
{"method":"copy", "params":[[{"cf": "<data format>", "data": "<data to put into clipboard>"},{}]]}Sometimes, it's not practical (or efficient) to put all the clipboard format data to the clipboard directly when copying.
This happens a lot when the user copies some texts that can be highlighted using html (image) format (which will require the client to convert the text to that format).
In that case, the client can put those data formats to the clipboard later by leaving the data field for those formats as null.
{"method":"copy", "params":[[{"cf": "<data format>", "data":null},{}]]}When other application requests those data formats, csclip will send get request to client.
{"method":"get", "params":["<data format>"]}Upon receving that, client should render the required format and responses back the result to csclip
{"result":"<requested data>"}Please refer to multiclip-mode for example of client implementation.