cut-paste with VNC on linux - why it is currently wrong

Ron Goldman
Wed Feb 12 08:04:00 2003

On Sun, 09 Feb 2003 13:38:21 Jerry McBride wrote:
> Can you clarify that a bit better? I've been cut-n-pasting on linux 
> servers and
> clients without any problems what-so-ever.

Sure, I'll try to expand on why the current way VNC on Linux handles 
cut-and-paste creates problems for our users.

(Short answer: If you just use emacs & xterm, VNC handles cut-and-paste 
just fine. If you use more "modern" apps like Netscape, Mozilla, Gnome 
apps, then VNC loses, especially for beginner Linux users.)

The source of the problem is that X clients do not handle cut-and-paste 
in a consistent way. X defines several mechanisms for making 
"selections". The oldest is the CUTBUFFER, which most apps no longer 
use, but is what VNC relies on. Then there are the PRIMARY, SECONDARY & 
CLIPBOARD selections. If you are used to selecting with your mouse and 
then pasting using the middle button then that generally uses the 
PRIMARY selection. Using the cut/copy/paste menu items sets the 

The way VNC works is that whenever a client sets the CUTBUFFER, the VNC 
server sends the text along to the remote VNC viewer. When the user on 
their remote system makes a selection (which for another Linux system 
means either the CUTBUFFER or the PRIMARY selection) then their VNC 
viewer sends over the text and the VNC server copies it to the 
CUTBUFFER and clears the PRIMARY selection.

For apps like emacs and xterm that always set the CUTBUFFER along with 
the PRIMARY selection this all works fine with VNC. For apps that just 
use the PRIMARY selection VNC never sees the selected text---try using 
something like gnome-terminal. To work around this people use xcutsel 
so after they make a selection they can manually tell xcutsel to copy 
it to the CUTBUFFER. Likewise when they select text on their remote 
machine, they use xcutsel to copy the CUTBUFFER to the PRIMARY 
selection so they can paste it. Some folks use autocutsel which 
automatically keeps the CUTBUFFER in sync with the PRIMARY selection by 
checking them every second or so. Beginners don't have a clue and just 
think that VNC is not able to cut-and-paste between the server & remote 

In the modern world of PCs & Macs & GNOME & KDE, folks now use the 
cut/copy/paste menu items to copy text between applications. (Only 
advanced Unix types use the middle mouse button.) In my original note I 
referenced an old email from when GNOME made just this switch. What I'm 
proposing is that it is now time for VNC to also join the modern world.

In our particular case with WorkSpot ( we provide 
people with access to a remote Linux desktop through their browser 
using VNC. So we are often working with people new to Linux and we need 
to make things like cut-and-paste work as they would expect them to. 
Thus we will shortly upgrade our Linux VNC server to use the clipboard. 
We hope other folks might want to do likewise.

Anyway hope that makes it clear why I'm bringing this issue up.

-- Ron --