8

I regularly uses xterm for web browsing because of its image rendering property but the one thing which makes xterm difficult comparing to terminal is the copy/cut paste availability in terminal program. I have found this method and according to this i saved the below code in .Xdefaults file in home directory

xterm -ls -xrm 'XTerm*selectToClipboard: true'&

After the implementation of this code I am able to select text in xterm but not able to copy or cut paste (using mouse or keyboard shortcuts ctrl+c etc) any text from or to the xterm.

Any idea what went wrong?

3 Answers 3

10

You can edit the XTerm file using vim or nano (I use vim):

vim /home/your_user_name/XTerm

Add this:

XTerm*Background: black
XTerm*Foreground: green
XTerm*SaveLines: 2000
XTerm*faceName: Ubuntu mono
XTerm*faceSize: 12
XTerm*rightScrollBar: true
XTerm*ScrollBar: true
XTerm*scrollTtyOutput: false
XTerm*VT100.Translations: #override \
      Shift Ctrl<Key>V: insert-selection(CLIPBOARD) \n\ 
      Shift Ctrl<Key>V: insert-selection(PRIMARY) \n\ 
      Shift<Btn1Down>: select-start() \n\ 
      Shift<Btn1Motion>: select-extend() \n\ 
      Shift<Btn1Up>: select-end(CLIPBOARD) \n\

Save and close with:

:wq

Open xterm:

xterm &

The above configuration does four things:

  1. Select and copy text into xterm:

    • Hold the Shift key.
    • Click the left mouse button.
    • Select your text.
    • Click the right mouse button to add it to the clipboard.
  2. Paste text into xterm by pressing Ctrl+Shift+V.

  3. Show the scrollbar.

  4. Customize the font.

3
  • 1
    How would you do Ctrl + Shift + c for interrput?
    – William
    Jan 21, 2017 at 17:02
  • You must stop pressing the left mouse button and the Shiht key.
    – simonced
    Feb 20, 2017 at 8:59
  • @Jayjayyy You are right! Then you can ignore it. Thanks
    – simonced
    Jun 18, 2018 at 21:35
8

You shall not include that line in .Xdefaults. Thus shalt thou start the program.

xterm -ls -xrm 'XTerm*selectToClipboard:true' &

Or with .Xdefaults:

Add this line:

XTerm*selectToClipboard:true

and reload the configuration

xrdb ~/.Xdefaults
4
  • 1
    It worked i am able to copy from xterm to a notepad but viseversa its not working.
    – Eka
    May 3, 2015 at 17:41
  • 3
    @Eka Shift+Insert
    – A.B.
    May 3, 2015 at 17:48
  • 1
    Better to use ~/.Xresources May 8, 2017 at 7:44
  • Note that if you use -class ${CLASS} to launch xterm the corresponding flag becomes -xrm ${CLASS}.*.selectToClipboard:true so if you have separate xterm window classes, settings are tracked separately.
    – stevesliva
    May 30, 2019 at 20:41
0

Handling shortcuts in Xterm

enter image description here

In Edit keyboard shortcuts you can than set what you want. Obviously if some key combination is taken you have to clear that assignment first from current use in order to use it for your commands.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .