You might not know who Larry Gordon Tesler was, but once you find out, you’ll feel like an underachiever. Seriously—there’s a whole Wikipedia page about his achievements at Apple, Amazon and Yahoo, on top of developing and coining some of the fundamental concepts of all modern personal computers: WYSIWYG (“What you see is what you get”), the first “browser,” and copy and paste. How many times a day do you cut, copy, or paste something on your computer or mobile device? We owe it all to Larry.
About the RDP Clipboard
RDP has built-in clipboard support, allowing you to copy and paste between your local session and the remote system exactly as if you were using it locally. It’s an incredibly convenient feature that even supports different clipboard types such as rich text, images, and files. You might know that the integrated RDP sessions in RDM Mac are built on top of FreeRDP rather than Microsoft’s own implementation (which cannot be embedded inside another application). FreeRDP supports the same clipboard functionality as the official Microsoft client, but until now, RDM Mac only integrated the basic text formats. We’re happy to announce that we’ve added support for several new clipboard types, including one of our most requested features: copy and paste of files!
Transferring Files via the Clipboard
As of RDM Mac 2022.1.13, if you want to transfer a file between your computer and a remote system connected through the embedded RDP session type, simply copy and paste it! Copy the file on your system and paste it onto the remote computer, or vice-versa. It’s that easy. Currently, this feature is in beta, and as such it does have some limitations. You can only transfer a single file (not a directory or list of files) at a time, and only transfer files between your computer and the remote session (i.e. you cannot copy a file in one session and paste it into another). The RDP protocol allows bypassing the clipboard entirely if the copied file is accessible via a mapped drive (this can improve performance), but we don’t support it yet. Finally, the maximum file size you can transfer is 4GB (and for some server versions, only 2GB): this is a technical limitation of the RDP protocol. We welcome your feedback on the changes and over time we’ll roll out incremental improvements on macOS, as well as support this functionality on RDM Linux and Windows (when using FreeRDP).
The Gory Details
Transferring files by copy and paste has been a long time coming due to technical challenges on the macOS side. Modern clipboards work using “delayed rendering”: when you copy something to the clipboard, the system advertises the data to other applications, but the data isn’t transferred until you actually paste. So when you copy a file on the remote system, its information is added to the clipboard, but the data doesn’t flow until you paste locally. Here’s the problem: the macOS Finder won’t allow you to paste a file unless it already exists on disk. Traditionally (and on other platforms), we could work around this by using a “virtual file system” which abstracts file access; but VFSs are not an appropriate solution on macOS (typically requiring a kernel extension, something no longer supported by Apple). Instead, when you copy a file on the remote system, we create a 0-byte temporary file on disk and advertise that to Finder.app. When you paste, we use a user-mode API to download the file on-the-fly, before finally letting the paste proceed from the temporary location. This approach works, but is responsible for some of the limitations noted above. We’re investigating a new set of VFS-like APIs on macOS 11 and newer that will allow us to provide a more seamless integration.