p0deje / Maccy

Lightweight clipboard manager for macOS
https://maccy.app
MIT License
13.11k stars 551 forks source link

[Feature request] Support copying files #85

Closed jadchaar closed 4 years ago

jadchaar commented 4 years ago

The recent feature addition for images in https://github.com/p0deje/Maccy/issues/44 is great, but I would also like to request support for accessing copied files like PDFs and such from the clipboard history.

Defman21 commented 4 years ago

Note that images copied from your computer (e.g. from the Desktop folder or "Copy Media" in Telegram which copies a cached version of the media under the hood) falls into NSPasteboard.PasteboardType.fileURL as well.

I'd go with storing file paths and showing them in HistoryItem's for anything but images (so it would look like /Users/user/some_file.pdf with maybe an icon to let the user know it's a file, not a string). For images, we can display the actual image itself (NSImage can create images from file URLs).

Note 2: we can actually put file URLs into clipboard and mark it as .fileURL and mac OS would do everything for us in other apps (paste the actual file instead of the path). So the only thing we're left with is displaying images/paths to files and support .fileURL. I'd provide a pull request for it as well.

p0deje commented 4 years ago

Implemented via 6a2b6aa.

The solution will work like this:

  1. Copied file is shown on the list like filename.
  2. When you copy it, it will be pasted as a file when possible.