I ran the minimal Debian installation inside a VirtualBox instance, installed X11 and Awesome window manager manually (without any custom configuration yet) and installed VirtualBox additions as well (and enabled shared clipboard in settings). However, copy-pasting text from xterm terminal still doesn't seem to work: CTRL+C is sent as a signal to a terminal, and Shift+Insert inserts the text that I had selected (which probably means that it got copied to some buffer somehow), but it is still unavailable from the host operating system.
X11 uses two buffers:
CLIPBOARD. To copy/paste to the
CLIPBOARD buffer you can often use CTRL-C and CTRL-V. You can insert to the
PRIMARY buffer by selecting a text and paste from it by pressing the middle mouse button.
If you want to use the
CLIPBOARD buffer, put this in your
~/.Xresources file and use Ctrl+Shift+C and Ctrl+Shift+V to copy/paste from/to the
CLIPBOARD buffer in xterm:
xterm*VT100.Translations: #override \ Ctrl Shift <Key>V: insert-selection(CLIPBOARD) \n\ Ctrl Shift <Key>C: copy-selection(CLIPBOARD)
You need to run
xrdb -merge ~/.Xresources after putting that into the file.
It is not necessary to modify the xterm translations resources to copy data to/from Firefox, unless you prefer to use the keyboard to help with the process.
Since 2006 xterm has a feature
selectToClipboard which lets you switch between the
PRIMARY selection (standard) and
CLIPBOARD (Firefox, etc).
Because some programs do use the primary selection, and some don't, it is a menu entry in xterm (controlmiddle-mouse):
Adapting the suggestion for control-characters like the GNOME applications lets you use the keyboard, and at the same let the menu switch between the two types of selections:
xterm*VT100.Translations: #override \ Ctrl Shift <Key>V: insert-selection(SELECT) \n\ Ctrl Shift <Key>C: copy-selection(SELECT)
although adding shiftInsert might be closer to the original intent:
xterm*VT100.Translations: #override \ Shift <Key>Insert: insert-selection(SELECT) \n\ Ctrl Shift <Key>V: insert-selection(SELECT) \n\ Ctrl Shift <Key>C: copy-selection(SELECT)
A plain controlC is usually assigned to an
$ stty -a speed 38400 baud; rows 40; columns 80; line = 0; intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
- Why can't I select/paste to/from other programs? (xterm FAQ)
xtermand highlight the text you want to copy.
- Go to the application in which you wish to paste and hover the mouse cursor over the field you want to paste in.
- Click the scroll button on your mouse. (on laptops this can be done by pressing left and right click at the same time)
When you highlight text, it copies the text to your primary buffer. Keep in mind that if you highlight any other text before pasting, that text will then replace the previous content in the primary buffer.
Turns out, I didn't account for the fact that X11 has two buffers: primary and clipboard. My text from xterm was copied into primary buffer, while I needed it in clipboard buffer.
I was able to fix the problem by installing
parcellite package, launching it and configuring it to synchronize two buffers.
What worked for me (openSuSe 42.3 x86_64) was extracted from https://www.davidsimmons.com/soft/xtermhacks/#copynpastenopatch. You can also check https://askubuntu.com/questions/237942/how-does-copy-paste-work-with-xterm/1300290#1300290 for other responses.
XTerm*VT100.translations: #override <Btn1Up>: select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0) and the run xrdb -merge ~/.Xresources.