Sunday, March 15, 2020

How to copy and paste from xterm & also to pop of the "confguration menus" (ramblings)

[edit March 29th: the procedure followed in xterm is: (1) within the shell window ctrl+{left & right click}to get VT Options then mouseover (using track pad) "select to clipboard" , (2) right click and drag to highlight text in shell (3) left click to select to clipboard (4) Ctrl+V to paste where you prefer.]

This link gives cut and paste that works with the xterm with no special arguments:
https://scarygliders.net/2011/12/01/customize-xterm-the-original-and-best-terminal/
"

2) Cutting and pasting with Xterm

Cutting text with xterm is pretty much the same as with gnome terminal. The difference being that any text you select, automatically gets placed into the clipboard.
  • Drag the mouse cursor along the text you wish to copy whilst holding down the LEFT mouse button.
  • double-clicking on a word will select that word (or if you’ve included my tweaks it’ll select a whole URL)
  • triple-clicking on a line will select that line"


this was a pain to finally arrive at. I created a ~/.Xsession file and failed.

=========

as a sidenote "configuration menus":

ctrl+leftmousebutton -> main options
ctrl+rightmousebutton ->vt options
ctrl_rightmousebutton -> unicode facts


use the  trackpad to scroll around. lift your finger to select.

==========

xclip allows me to redirect output from a command to the clipboard. However I do not know how to configure it to allow be to use Ctrl+C, Ctrl+Shift+C Ctrl+PrtSrc (?) .

==============

xclip redirects output of a command to the clipboard:

https://opensource.com/article/19/7/xclip

===============

Payloads written to ~/.Xsession (2) and (3) starting with the link:
https://superuser.com/questions/487973/what-is-alternative-for-middle-click-paste-in-xorg

"
In most X11 programs, ShiftInsert should work – it pastes from the same "PRIMARY" selection that xterm copies to.
If you need to paste to Firefox or Chromium, though, you will need a program that synchronizes both selections, such as Klipper (KDE), Parcellite/Clipit (GNOME), or loliclip (generic). [The term is "clipboard manager".]

Alternatively, configure Xterm to copy to the "CLIPBOARD" selection instead, by adding one of the following to your ~/.Xresources file:
  1. Retain normal behavior when selecting, but copy to "CLIPBOARD" when CtrlShiftC is pressed:
    XTerm*vt100*translations:   #override           \n\
        Shift <Key> Delete: insert-selection(SELECT)    \n\
        Shift Ctrl <Key> C: select-end(CLIPBOARD)       \n\
        Shift Ctrl <Key> V: insert-selection(CLIPBOARD) \n\
        Shift Ctrl <Key> N: spawn-new-terminal()        \n
    
  2. Always copy to "CLIPBOARD" when selecting:
    XTerm*selectToClipboard: true
    
(Run xrdb -merge ~/.Xresources after editing.)

"

I have no idea where the middle click is. (I have a trackpad and a left and right mouse button)

xdm must have something to do with xterm  (/etc/X11/xdm) , (/etc/X11)

http://www.rru.com/~meo/pubsntalks/xrj/xdm.html


======

this fun stuff must be for ubuntu+gnome (https://www.howtogeek.com/440558/how-to-copy-and-paste-text-at-linuxs-bash-shell/) b/c it does not work for me

=======


 curiously, I can get Ctrl+C and Ctrl+V to work with xterm using:

"
30

Xterm uses cut buffers, not the standard X11 clipboard selection used for standard copy-paste that gnome-terminal and most other Linux programs now use.
But if you start xterm like this:
xterm -ls -xrm 'XTerm*selectToClipboard: true'&
then selections are available via the standard clipboard.
Read more at Copying and Pasting in Xterm | StarNet Knowledge Database - PC X, X Windows, X 11 & More - StarNet
The xcb program also provides command-line access to the cut buffers.
E.g. in Trusty Tahr 12.04, running lxde window manager, I can triple click on a line of text in xterm, which highlights it and puts it in cut buffer 0. I can then run xcb -p 0 which prints the line out on stdout.
For some reason it didn't work for me to click both buttons (simulating middle click) in an xterm, but shift-insert did work in an xterm.
" (https://askubuntu.com/questions/237942/how-does-copy-paste-work-with-xterm) ... I had an .Xsession file, but I do not know if it was used. I did not use the restarting xdm method described in (http://www.rru.com/~meo/pubsntalks/xrj/xdm.html) ... there are a lot of rc.d(?) (process daemons running) on startup that I do not understand.

================

In the process I discovered tmux:

https://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/

which the link describes as:

"tmux’s authors describe it as a terminal multiplexer. Behind this fancy term hides a simple concept: Within one terminal window you can open multiple windows and split-views (called “panes” in tmux lingo). Each pane will contain its own, independently running terminal instance."



No comments:

Post a Comment