top | item 44577869

Show HN: Clippy – a better pbcopy for macOS that handles files properly

34 points| nberkman | 7 months ago |github.com

I made clippy because pbcopy can't do something I needed every day: copy files to paste into GUI apps. When you pbcopy < image.png, you get raw bytes instead of a file that Slack or email can use.

Clippy fixes this:

- clippy report.pdf → ⌘V into any app uploads the file

- curl image.png | clippy → pipes become pasteable files

- clippy *.jpg → multiple files at once

- Text files still work like pbcopy

Technical: Direct Objective-C bindings via CGo. Copies file references (like Finder), not contents. Auto-cleans temp files. No AppleScript hacks.

Install: brew install neilberkman/clippy/clippy

14 comments

order

feraldidactic|7 months ago

A certain large software concern might take issue with the name. Mac users of a certain age might just run…

winkelmann|7 months ago

> the name

Rust's linter is also called Clippy, and they don't seem to have any issues.

moek|7 months ago

i like the name, it is easy to remember for this use case :)

nocsi|7 months ago

So technically the OS is supposed to be handling this, or at the least whatever app you're in is supposed to signal the MIME to the pasteboard. They even updated the APIs for it this year. I'm not complaining, just giving away loose headsup that they might rugpull you. Apple is particularly not a fan of oblique data transformations, especially since malware keeps going after the user's pasteboards.

Something worth implementing is multiple layers to the pasteboard content, so you're at least maintaining the original raw bytes. That and I always wanted a pasteboard that let you append contents to it. Just some ideas to consider

nberkman|7 months ago

Thanks. I just released a new version with UTI based MIME type detection as the primary method with a fallback to the existing content-based detection.

donatj|7 months ago

Neat, I was actually looking for something like this a few months ago to help automate part of a workflow.

Be kind of nice if this also worked as a library rather than having all the workings in internal where they can't be called.

Unrelated: Is yo.txt in the root just junk?

nberkman|7 months ago

Removed, thanks!

physPop|7 months ago

clippy is kind of taken (a very popular rust linter). Suggest considering a new name to differentiate yourself!

jdmg94|7 months ago

linux compat would've been nice

wut42|7 months ago

already exists, xsel and xclip does that, iirc.