-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support pasting clipboard from host #14
Comments
Yeah, I've poked around the code and didn't find a way to support it. Seems there is no way to get handle on a keyboard to send fake strokes. A workaround for people might be enabling Screen Sharing and using VNC via running a VM with |
So, sending Also, maybe can we manually call methods like |
I haven't found a public API to interact with a keyboard. As far as I understood
|
It seems it will be possible. At least according to a new Linux example (see "Enable copy-and-paste support between the host and the guest" section): private func createSpiceAgentConsoleDeviceConfiguration() -> VZVirtioConsoleDeviceConfiguration {
let consoleDevice = VZVirtioConsoleDeviceConfiguration()
let spiceAgentPort = VZVirtioConsolePortConfiguration()
spiceAgentPort.name = VZSpiceAgentPortAttachment.spiceAgentPortName
spiceAgentPort.attachment = VZSpiceAgentPortAttachment()
consoleDevice.ports[0] = spiceAgentPort
return consoleDevice
} Need to verify that it will work in macOS though. |
I've tried the above example and a bit different one: let spiceAgentPortAttachment = VZSpiceAgentPortAttachment()
spiceAgentPortAttachment.sharesClipboard = true
let serialPortConfiguration = VZVirtioConsoleDeviceSerialPortConfiguration()
serialPortConfiguration.attachment = spiceAgentPortAttachment
configuration.serialPorts = [serialPortConfiguration] with the latest Ventura and it seems not be working. It might be indicating that it only works for Linux. Will need to investigate more. |
@fkorotkov Hey, 048a550 doesn't support clipboard sharing on Linux. A spice agent is necessary, similar to what you posted in #14 (comment) #287 also fixes this issue. Would you prefer a standalone PR for clipboard sharing? |
Right. 048a550 was only about trackpad support. @edigaryev had some security concerns as well about enabling clipboard sharing by default. Will be probably better to put the clipboard support under a flag or maybe do similar to what "Screen Sharing" app is doing e.g. only share things copied to clipboard after launching a session. It seems "Screen Sharing" either cleans the clipboard upon session creation or doing something else. Haven't investigated the behaviour in more details. |
Ah, the commit message says
I think a flag makes sense. Some users may want an isolated VM with no clipboard support. Does What do you think about having a Parallels has a simple UI. The settings could also be available via flag for the command line use case. |
Right now config is stored in a JSON file and can be altered via |
I looked into this and it seems like Swift Package Manager doesn't play nice with macOS apps. For full SwiftUI support (including view previews), Xcode is expecting an Xcode project. |
hey @fkorotkov any breakthroughs here? Just came across this thread trying to help another team at work. Not super familiar with swift but I have modified the VMInstance file of MacVM. There biggest pain point right now is clipboard sharing, hoping to either resolve let them know it is still not currently possible. |
I've just tried building & running Tart on a macOS 14.0 Sonoma (23A5276g) host with macOS 14.0 Sonoma (23A5276q) guest with the following snippet added to a // Clipboard sharing
let spiceAgentPortAttachment = VZSpiceAgentPortAttachment()
spiceAgentPortAttachment.sharesClipboard = true
let spiceAgentPort = VZVirtioConsolePortConfiguration()
spiceAgentPort.name = VZSpiceAgentPortAttachment.spiceAgentPortName
spiceAgentPort.attachment = spiceAgentPortAttachment
let consoleDevice = VZVirtioConsoleDeviceConfiguration()
consoleDevice.ports[0] = spiceAgentPort
configuration.consoleDevices = [consoleDevice] With this snippet,
This device is also present in
However, when attempting to access either of these devices (e.g. using
So I guess it's not ready for macOS yet or I'm doing something wrong. I've also found a similar issue in another project utilizing |
Thank you for your efforts @fkorotkov |
All thanks to @edigaryev for double checking! 🙌 |
There is another tool like Seems like the solution is to simply have a helper app within the guest VM to allow this. |
I've found that uniclip helps quite a lot, there's still the hassle of copying and pasting files, but file sharing via smb is a good solution. |
It seems it's not supported at the moment with the current API according to this comment and based on my research at the time. But let's create a tracking issue.
The text was updated successfully, but these errors were encountered: