Open NattyNarwhal opened 2 years ago
This would be great. Would the best way to be enable it automatically if clipboard sharing is disabled in settings? Possibly also if the spice client could not find a channel (i.e. the guest tools are not installed).
You can already do this via the UTM URL Scheme. Any key press you want entered can be passed via the sendText
command.
For example (from the above link): utm://sendText?name=Ubuntu%2020.04&text=abcdef
types "abcdef" in the VM "Ubuntu 20.04"
OK, thanks. Now I just need to make a script. I assume I just need to urlencode the text to paste as it is usually a password.
Yes, this is explained in detail in the wiki.
It might be worth reopening, since this issue would be about exposing it in the GUI because the feature is already implemented on the backend.
I haven't cloned or tried to build yet (it's late here and I don't know SwiftUI very well), but looking at the source:
automationSendText
in UTMData
, which only handles the SPICE casepaste:
, VMDisplayWindowController
should have the @IBAction
paste:
automationSendText
, implement said selector in VMDisplayQemuMetalWindowController
(edit: or the actual SPICE view, if it's in the responder chain?)I think something like this in the toolbar would be cluttering. For some dumb apple api reasons we can’t actually use the menu bar for VMs without a significant front end rewrite and that would be the logical place for this option.
Sorry, I did not realize the sendText
isn't implemented for the new Virtualization backend.
I think something like this in the toolbar would be cluttering. For some dumb apple api reasons we can’t actually use the menu bar for VMs without a significant front end rewrite and that would be the logical place for this option.
Hmm, I'm more familiar with raw AppKit, but couldn't the SwiftUI VM window or the SPICE view implement one of the selectors already in the menu (in this case, paste:
), and have it work through the responder chain?
Having the other VM commands appear in the menu would be nice, but I'm not familiar enough with SwiftUI to know why.
Another, simpler workaround which I now use regularly (on macOS guest VMs):
Turn on screen sharing in your VM. Then you can connect to it via Screen Sharing, from the host or any other Mac on your local network. Copy and paste works fine via screen sharing.
Note that I use Bridged Networking in my (virtualized) VMs. This may not work otherwise.
Sorry, I did not realize the
sendText
isn't implemented for the new Virtualization backend.
Any other way to get text copied from the host to the VM? (macOS-macOS and no option for screen share in my case)
In the event that clipboard sync into the guest isn't supported (i.e. installation, no guest tools support), it's annoying when you need paste text into the VM that's annoying to type out by hand (i.e. license keys, a medium-sized set of commands). It would be nice if UTM handled this.
I could imagine this works by just making the VM display accept
paste:
, then have it send the keys required as if the user typed them (with some debounce).