Determine the source application of current pasteboard content

爷,独闯天下 提交于 2019-12-05 05:56:05

I believe that the way CopyLess and Alfred 2 (which also supports this) work is that they have a timer that checks the clipboard for changes. When they see a change on the clipboard they get the active application and associate that app with the change. It's likely not a foolproof method but should work in most cases.

There's a new quasi-standard for this now (as of Dec 2016), see http://nspasteboard.org

It works as follows:

  • By default, a program that records the clipboard contents shall assume that the frontmost application is the one that filled the clipboard (which, admittedly, only works if the program is already running when the clipboard content is set).

  • But if there's a clipboard flavor (kind) of type org.nspasteboard.source, then this flavor's content shall be the Bundle ID of the app that filled the clipbard.

(This is a quasi-standard because it has been discussed and agreed upon by interested members of a mailing list managed by nspasteboard.org)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!