Tuesday, April 30, 2024
 Popular · Latest · Hot · Upcoming
101
rated 0 times [  101] [ 0]  / answers: 1 / hits: 26660  / 1 Year ago, sat, february 11, 2023, 6:50:59

I am trying to copy from the terminal with xclip and paste it into the unity desktop environment into gedit text editor. I can copy and paste with xclip in terminal:



$ cat line-size.c | xclip
xclip -o > input5.txt
cat input5.txt
#include <stdio.h>
...


However, when I press control + v to paste into gedit, it only pastes the actual last thing I copied within unity desktop, such as something from firefox browser.



How can I paste in gui applications something I copied from terminal?


More From » xclip

 Answers
3

I think it is just a matter of understanding the different selection clipboards used by the xclip utility



   -selection
specify which X selection to use, options are "primary" to use
XA_PRIMARY (default), "secondary" for XA_SECONDARY or "clip‐
board" for XA_CLIPBOARD


When you do cat line-size.c | xclip the default behaviour is to copy to the primary X selection buffer - to paste from that buffer, you need to use a mouse middle-click instead of the Ctrl+v combination.



To copy into the clipboard instead, so that you can paste with Ctrl+v, you would need to do



cat line-size.c | xclip -selection clipboard

[#28206] Saturday, February 11, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
fectlyole

Total Points: 64
Total Questions: 110
Total Answers: 110

Location: Nicaragua
Member since Thu, Feb 3, 2022
2 Years ago
fectlyole questions
Sun, May 8, 22, 02:54, 2 Years ago
Mon, Jun 21, 21, 16:56, 3 Years ago
Fri, Jul 9, 21, 17:44, 3 Years ago
;