dumpclip - a utility for dumping clipboard contents
dumpclip is a simple utility that prints clipboard contents to the console as JSON. It supports text and files content.
Copy some text into the clipboard and run the program.
Clipboard contents will be serialized as JSON and written to the console:
Copy some files and try again.
Listen to clipboard changes
Run the program with
The program will listen to the clipboard and dump contents to the console when the clipboard content changes. You can stop listening by exiting the program with Ctrl + C
Python script for monitoring clipboard
The main reason I've built this utility was to integrate it into a Python script. So here's a simple function that runs the app and captures its stdout and calls the given callback.
import json import subprocess import threading from typing import Callable def monitor_clipboard(on_change: Callable[[dict], None]) -> None: def listen_stdout(proc: subprocess.Popen): for line in iter(proc.stdout.readline, ""): if line.strip(): payload = json.loads(line) on_change(payload) proc = subprocess.Popen( ["dumpclip.exe", "--listen"], text=True, universal_newlines=True, stdout=subprocess.PIPE, ) th = threading.Thread( target=listen_stdout, args=(proc,), ) th.start() try: proc.wait() except KeyboardInterrupt: proc.kill() raise if __name__ == "__main__": monitor_clipboard(on_change=print)
I've also written a short post as to why I made this and how it progressed.