0

I've got this XTerm file:

XTerm*Background: black
XTerm*Foreground: white
XTerm*SaveLines: 2000
XTerm*faceName: "Font Awesome 5 Brands-Regular-400"
XTerm*faceSize: 8
XTerm*rightScrollBar: true
XTerm*ScrollBar: true
XTerm*scrollTtyOutput: true
XTerm*VT100.Translations: #override \
      Ctrl<Key>V: insert-selection(CLIPBOARD) \n\ 
      Ctrl<Key>V: insert-selection(PRIMARY) \n\ 
      Shift<Btn1Down>: select-start() \n\ 
      Shift<Btn1Motion>: select-extend() \n\ 
      Shift<Btn1Up>: select-end(CLIPBOARD) \n\
Ctrl <Key>C: copy-selection(CLIPBOARD) \n
Ctrl <Key>V: insert-selection(CLIPBOARD)

under FreeBSD 11.2, with i3 4.15 and X.Org 1.18.4, I find using Ctrl+C doesn't copy selected text to clipboard from XTerm, although Ctrl+V does paste text. Other applications are having no problem with copying text to clipboard. Is there some magic trick to get this to work under FreeBSD that isn't necessary under Linux (as under Linux copying with Ctrl+C goes fine with this XTerm file)?

6
  • xterm instatly copies text to clipboard(primary) after selection. no need to press a key. Sep 17 '18 at 3:02
  • OK, well that isn't working either then. When I select the text it isn't copied, as I've tried pasting it into Leafpad. I know that middle-clicking a selection does it, but I'd like to with Ctrl+C.
    – Josh Pinto
    Sep 17 '18 at 3:03
  • then read the fine manual of xterm: " selectToClipboard (class SelectToClipboard) Tells xterm whether to use the PRIMARY or CLIPBOARD for SELECT tokens in the selection mechanism. The set-select action can change this at runtime, allowing the user to work with programs that handle only one of these mechanisms. The default is “false”, which tells it to use PRIMARY." Sep 17 '18 at 3:16
  • May be you have to try "Ctrl+Shift+c" to copy and "Ctrl+Shift+v" to paste. My answer is based on debian, but this may work for you too.
    – koleygr
    Sep 17 '18 at 3:22
  • @IporSircer Thanks, although must admit I'm not sure I really understand what that means for me. Like how do I get the behaviour I want? Unfortunately, sometimes man pages are worded in a difficult way for me to follow.
    – Josh Pinto
    Sep 17 '18 at 3:27
0

The problem is in the sample .Xdefaults file:

  • select/paste from that shows that the original had trailing blanks (which interfere with the formatting into separate lines/separate actions)
  • there's a missing backslash anyway.
  • that "#" in the beginning is a comment which extends to the end of the line. A missing \n\ made the first instance of controlV ignored.

My text editor (vi like emacs) shows me the problem, using syntax highlighting. Actually (double-checking), vim does not highlight the problem. But you can see the trailing blanks in any vi by turning on the list option:

XTerm*Background: black^J
XTerm*Foreground: white^J
XTerm*SaveLines: 2000^J
XTerm*faceName: "Font Awesome 5 Brands-Regular-400"^J
XTerm*faceSize: 8^J
XTerm*rightScrollBar: true^J
XTerm*ScrollBar: true^J
XTerm*scrollTtyOutput: true^J
XTerm*VT100.Translations: #override \^J
      Ctrl<Key>V: insert-selection(CLIPBOARD) \n\ ^J
      Ctrl<Key>V: insert-selection(PRIMARY) \n\ ^J
      Shift<Btn1Down>: select-start() \n\ ^J 
      Shift<Btn1Motion>: select-extend() \n\ ^J
      Shift<Btn1Up>: select-end(CLIPBOARD) \n\^J
Ctrl <Key>C: copy-selection(CLIPBOARD) \n^J
Ctrl <Key>V: insert-selection(CLIPBOARD)^J

Syntax highlighting helps with the missing \n\, etc., by pointing out anomalies in the resource. Plain vi does not help with that.

After fixing:

XTerm*Background: black^J
XTerm*Foreground: white^J
XTerm*SaveLines: 2000^J
XTerm*faceName: "Font Awesome 5 Brands-Regular-400"^J
XTerm*faceSize: 8^J
XTerm*rightScrollBar: true^J
XTerm*ScrollBar: true^J
XTerm*scrollTtyOutput: true^J
XTerm*VT100.Translations: #override \n\^J
      Ctrl<Key>V: insert-selection(CLIPBOARD) \n\^J 
      Ctrl<Key>V: insert-selection(PRIMARY) \n\^J 
      Shift<Btn1Down>: select-start() \n\^J  
      Shift<Btn1Motion>: select-extend() \n\^J 
      Shift<Btn1Up>: select-end(CLIPBOARD) \n\^J
Ctrl <Key>C: copy-selection(CLIPBOARD) \n\^J
Ctrl <Key>V: insert-selection(SELECT)^J

Here is (select/paste again) a text which works for me:

XTerm*Background: black
XTerm*Foreground: white
XTerm*SaveLines: 2000
XTerm*faceName: "Font Awesome 5 Brands-Regular-400"
XTerm*faceSize: 8
XTerm*rightScrollBar: true
XTerm*ScrollBar: true
XTerm*scrollTtyOutput: true
XTerm*VT100.Translations: #override \n\
      Ctrl<Key>V: insert-selection(CLIPBOARD) \n\
      Ctrl<Key>V: insert-selection(PRIMARY) \n\
      Shift<Btn1Down>: select-start() \n\
      Shift<Btn1Motion>: select-extend() \n\
      Shift<Btn1Up>: select-end(CLIPBOARD) \n\
Ctrl <Key>C: copy-selection(CLIPBOARD) \n\
Ctrl <Key>V: insert-selection(SELECT)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.