p0deje / Maccy

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

[Feature Request] Possibility to exclude apps. #65

Closed bognarlaszlo closed 4 years ago

bognarlaszlo commented 5 years ago

It would be really nice if one could set applications (like password managers) to be excluded. EDIT: I understand that I can delete specific items from the list, but it would be much nicer if passwords were never saved to Maccy's clipboard list.

p0deje commented 5 years ago

It's not possible as Maccy has no way to identify which apps the text was copied from. I'd love that feature, but I don't know any way to implement it.

bognarlaszlo commented 5 years ago

Thanks for the quick reply. I've never written macOS applications nor do I have any experience with C or Swift, however I think the solution would be as "easy" as to watch for the frontmost application (and compare it with the extended applications). At least this is how it works from an AppleScript.

EDIT: I've found this on SO. This might be useful. Please consider it as it may be a very useful feature - if it's worth your work time.

p0deje commented 5 years ago

Ok, thanks for the link. I'll check it out.

georgesnow commented 5 years ago

You can use nsworkspace shared workspace. This will tell you the front most application/active. I have done this in my plugin for a different app for hotkey to display an application. I can provide a link to my repo if it would be helpful.

https://developer.apple.com/documentation/appkit/nsworkspace/1532097-frontmostapplication?language=objc

georgesnow commented 5 years ago

http://nspasteboard.org/

Check that site out. Apps like password managers should mark their items being placed in the pasteboard as “transient”

p0deje commented 4 years ago

Thanks for the link, that definitely makes sense to support. I've checked that, for example, LastPass adds a password with org.nspasteboard.TransientType type, so I'm simply going to completely ignore the types listed in http://nspasteboard.org.

p0deje commented 4 years ago

For now, it doesn't allow to specify custom application bundle identifiers. However, it should cover most cases with password managers. Please raise new issues if particular apps are not handled and should be excluded.