I found out how to get the content of the NSPasteboard, and to copy it into my active application. I haven't found a way to paste it into another application, just how to paste it into my current application.
我发现了如何获取NSPasteboard的内容,并将其复制到我的活动应用程序中。我还没有找到将其粘贴到另一个应用程序的方法,只是如何将其粘贴到我当前的应用程序中。
If you're wondering why I would want to do this, I'm researching if there is a way to improve Jumpcut open source application (jumpcut.sf.net). Currently, it fakes Cmd+v to paste the content into another application, but this doesn't work on X11 (which expects Ctrl+v).
如果你想知道我为什么要这样做,我正在研究是否有办法改进Jumpcut开源应用程序(jumpcut.sf.net)。目前,它假装Cmd + v将内容粘贴到另一个应用程序中,但这不适用于X11(需要Ctrl + v)。
Thank you
1 个解决方案
#1
0
The problem is that X11 doesn't really understand the OS X pasteboard at all, so there's some special magic going on to map whatever's on the OS X pasteboard into a form which can be used as the X pasteboard. Depending on what you're prepared to "know" about the target app, you can do something inbetween sending a simulated Ctrl-V event and coercing the app into requesting the content of the clipboard (not the primary clip buffer, which is the middle-click one in X)
问题是X11根本不了解OS X粘贴板,因此有一些特殊的魔法可以将OS X粘贴板上的任何内容映射到可用作X粘贴板的形式。根据您准备“了解”目标应用程序的内容,您可以在发送模拟的Ctrl-V事件和强制应用程序之间执行某些操作来请求剪贴板的内容(而不是主剪辑缓冲区,这是中间的在X中单击一个)
#1
0
The problem is that X11 doesn't really understand the OS X pasteboard at all, so there's some special magic going on to map whatever's on the OS X pasteboard into a form which can be used as the X pasteboard. Depending on what you're prepared to "know" about the target app, you can do something inbetween sending a simulated Ctrl-V event and coercing the app into requesting the content of the clipboard (not the primary clip buffer, which is the middle-click one in X)
问题是X11根本不了解OS X粘贴板,因此有一些特殊的魔法可以将OS X粘贴板上的任何内容映射到可用作X粘贴板的形式。根据您准备“了解”目标应用程序的内容,您可以在发送模拟的Ctrl-V事件和强制应用程序之间执行某些操作来请求剪贴板的内容(而不是主剪辑缓冲区,这是中间的在X中单击一个)