Virtualbox clipboard workaround
With Virtualbox OSE 1.5.2, host Kubuntu 7.10 and guest Win XP I have intermittent clipboard problems: Garbled text, often even from one Linux app to another.
I tried upgrading to VirtualBox 1.5.4 non-free but had network problems with it.
Finally I came up with the following workaround. The idea is to write/read the clipboard using a temporary shared file. Prerequisites:
- Install xclip in Kubuntu.
- Put the cat, pclip and gclip commands in the PATH of the Windows system.
- Set up a Samba share that both guest and host can read and write to.
In my setup the share is /share in the guest and mounted as network drive S: in the guest. The temporary file will be in /share/clipboard/.
Create an application shortcut in Kubuntu with the Application command
xclip -o > /share/clipboard/clip.txt
and drag it on the taskbar so that you can execute it with one click. To avoid annoying startup notifications disable them in the “Advanced Options” in the “Application” tab of the shortcut. Now you should be able to copy the content of the X clipboard to the temporary file with one click.
In the guest system (Windows) you do the same thing in reverse but with a keyboard shortcut: Put a file clip-in.bat into a safe location (where you won’t accidentally delete it) with the following one line of code:
cat S:\clipboard\clip.txt | gclip
Create a desktop shortcut pointing to clip-in.bat and define a keybard shortcut for it (under right-click, Properties..), e.g. ALT-CTRL-C.
Now you should be able to mark and paste from the host to the guest system in the following way:
- Mark some text in the host (Kubuntu) system
- Click the shortcut in the KDE taskbar
- In the host system press CTR-ALT-C and then CTRL-V (to paste)