Copy any selection to clipboard
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Copy any selection to clipboard
Edit 2013-4-13: I changed the thread title (was: Terminal emulator (urxvt etc.): Copy selection to clipboard) to reflect the fact that my proposal is not restricted to the use in a console. I also added an alternative method which makes copying easier.
---------------------------
Users switching from MS Windows to Linux take it for granted that the keyboard shortcut Ctrl+C will put selected text into the clipboard. Big surprise when in a terminal window like urxvt this doesn't apply anymore.
Experienced users know that Linux holds every selection in a "primary" buffer and that in any application this buffer can be pasted with the middle mouse button or - now it's getting complicated - in a console window also with Shift+Insert.
Still there are many situations where copying terminal text to the clipboard would be useful. The lack of a middle mouse button is only one of them.
Here are 2 simple ways to create a "Copy to Clipboard" shortcut (Ctrl+Shift+C) :
Method 1: Keyboard shortcut with JWM
Step 1: Edit the file /root/.jwm/jwmrc-personal. Add 1 line:
<Key mask="CS" key="c">exec:xclip -o|xclip -sel clip</Key>
Step 2: Restart JWM
Method 2: Keyboard shortcut/desktop icon with ROX
seethis post
Text copied with Ctrl+Shift+C can then be pasted into other applications with the familiar Ctrl+V.
That's it....well, almost:
Above shortcut uses the tool xclip, which is included in all Puppy versions I tested. However even newest Puppy versions use the old xclip version 0.08 (typing xclip -version into a terminal window reveals the version). This version does not support UTF-8 characters and users of languages with funny characters like French, German or Japanese might get pasted ASCII salad instead. See here
As mentioned in the link a new version can be obtained at http://slackware.org.uk/slacky/slackware-14.0/utilities/xclip/0.12/
Download xclip-0.12-i486-2sl.txz , extract the file /usr/bin/xclip (all the other stuff is not important) and copy it to /usr/bin. This will not overwrite the old version which - for obscure reasons - resides in usr/X11R7/bin. When calling xclip Puppy will first look into /usr/bin, will find the new version and will not bother to look any further. Tested in Slacko, Precise and Lupu.
.
---------------------------
Users switching from MS Windows to Linux take it for granted that the keyboard shortcut Ctrl+C will put selected text into the clipboard. Big surprise when in a terminal window like urxvt this doesn't apply anymore.
Experienced users know that Linux holds every selection in a "primary" buffer and that in any application this buffer can be pasted with the middle mouse button or - now it's getting complicated - in a console window also with Shift+Insert.
Still there are many situations where copying terminal text to the clipboard would be useful. The lack of a middle mouse button is only one of them.
Here are 2 simple ways to create a "Copy to Clipboard" shortcut (Ctrl+Shift+C) :
Method 1: Keyboard shortcut with JWM
Step 1: Edit the file /root/.jwm/jwmrc-personal. Add 1 line:
<Key mask="CS" key="c">exec:xclip -o|xclip -sel clip</Key>
Step 2: Restart JWM
Method 2: Keyboard shortcut/desktop icon with ROX
seethis post
Text copied with Ctrl+Shift+C can then be pasted into other applications with the familiar Ctrl+V.
That's it....well, almost:
Above shortcut uses the tool xclip, which is included in all Puppy versions I tested. However even newest Puppy versions use the old xclip version 0.08 (typing xclip -version into a terminal window reveals the version). This version does not support UTF-8 characters and users of languages with funny characters like French, German or Japanese might get pasted ASCII salad instead. See here
As mentioned in the link a new version can be obtained at http://slackware.org.uk/slacky/slackware-14.0/utilities/xclip/0.12/
Download xclip-0.12-i486-2sl.txz , extract the file /usr/bin/xclip (all the other stuff is not important) and copy it to /usr/bin. This will not overwrite the old version which - for obscure reasons - resides in usr/X11R7/bin. When calling xclip Puppy will first look into /usr/bin, will find the new version and will not bother to look any further. Tested in Slacko, Precise and Lupu.
.
Last edited by MochiMoppel on Mon 13 Apr 2015, 07:08, edited 1 time in total.
FWIW there are simple patches to fix gtk 2 and 3 to add this feature.Experienced users know that Linux holds every selection in a "primary" buffer and that in any application this buffer can be pasted with the middle mouse button or - now it's getting complicated - in a console window also with Shift+Insert.
Do you know a good gtkdialog program? Please post a link here
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Nice.
If you use xsel instead of xclip and combine it with xdotool you can also paste.
If you use xsel instead of xclip and combine it with xdotool you can also paste.
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==
Hello, disciple.disciple wrote:FWIW there are simple patches to fix gtk 2 and 3 to add this feature.Experienced users know that Linux holds every selection in a "primary" buffer and that in any application this buffer can be pasted with the middle mouse button or - now it's getting complicated - in a console window also with Shift+Insert.
Stating your sources or a how-to would be most useful!
Thanks in advance. BFN.
musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Works for everybody, but middle click will paste at the mouse cursor point, Ctrl-shift-V at the text cursor pointFlash wrote:Highlighting text I want to copy, then simultaneously clicking the left and right mouse buttons to paste it, has worked for me in every version of Puppy I've used. Am I the only one this works for?
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==
Now the man tells us!mavrothal wrote:Works for everybody, but middle click will paste at the mouse cursor point, Ctrl-shift-V at the text cursor pointFlash wrote:Highlighting text I want to copy, then simultaneously clicking the left and right mouse buttons to paste it, has worked for me in every version of Puppy I've used. Am I the only one this works for?
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Fantastic!! Mavrothal's link suggested using Shift+Insert as a method to paste into the terminal. Seems to work for me! I previously had to use left and right click simultaneously for the 'paste' function. So now I can use that technique for paste and Mochis mod for copy.
I would be even happier if there was some way to set up "Shift+Ctrl+V" for the paste. Now that I have got used to Mochi's mod it seems so natural for me that adding "Shift" to Ctrl+c lets me copy from terminal, so I'd like to just add "Shift" to Ctrl+v for the paste into terminal.
EDIT : Faceslap !!! Now I see Mochi mentioned Shift+insert in the first post. I can be soooo stoopid. All these months there was an easier way...
.
ps: I'd still love to see shift+insert replaced by Shift+Ctrl+v
I would be even happier if there was some way to set up "Shift+Ctrl+V" for the paste. Now that I have got used to Mochi's mod it seems so natural for me that adding "Shift" to Ctrl+c lets me copy from terminal, so I'd like to just add "Shift" to Ctrl+v for the paste into terminal.
EDIT : Faceslap !!! Now I see Mochi mentioned Shift+insert in the first post. I can be soooo stoopid. All these months there was an easier way...
.
ps: I'd still love to see shift+insert replaced by Shift+Ctrl+v
yep just noticed the shift insert which for me makes life much easier... especially with some laptops/netbook interfaces... I wonder what we will find out thats been hidden in the next 9 years
xbinkeys or xmodmap or something might be useful... but to be honest a mouse free method is a big bonus..no more triple pastes
mike
xbinkeys or xmodmap or something might be useful... but to be honest a mouse free method is a big bonus..no more triple pastes
mike
GTK ignoring the standard behaviour in X to paste the Primary Selection with Shift-Insert.MochiMoppel wrote:Thanks - now we are twogreengeek wrote:I have been using it for quite a while now and it makes every day so much better!Fix what?disciple wrote:FWIW there are simple patches to fix gtk 2 and 3 to add this feature.
That one.Add which feature?
Do you know a good gtkdialog program? Please post a link here
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
http://murga-linux.com/puppy/viewtopic.php?t=80150musher0 wrote:Hello, disciple.disciple wrote:FWIW there are simple patches to fix gtk 2 and 3 to add this feature.Experienced users know that Linux holds every selection in a "primary" buffer and that in any application this buffer can be pasted with the middle mouse button or - now it's getting complicated - in a console window also with Shift+Insert.
Stating your sources or a how-to would be most useful!
Thanks in advance. BFN.
musher0
Do you know a good gtkdialog program? Please post a link here
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
I'm assuming when you say "Mochi's reference" that's a slip up?musher0 wrote:Thanks, disciple.
I did read Mochi's reference, but it sounded like Martian, and it made me
grumpy... I'll re-read it with a rested head tomorrow...
Do you know a good gtkdialog program? Please post a link here
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
- BarryK
- Puppy Master
- Posts: 9392
- Joined: Mon 09 May 2005, 09:23
- Location: Perth, Western Australia
- Contact:
Re: Terminal emulator (urxvt etc.): Copy selection to clipboard
Thanks for bringing that to my attention!MochiMoppel wrote: Above shortcut uses the tool xclip, which is included in all Puppy versions I tested. However even newest Puppy versions use the old xclip version 0.08 (typing xclip -version into a terminal window reveals the version). This version does not support UTF-8 characters and users of languages with funny characters like French, German or Japanese might get pasted ASCII salad instead. See here
As mentioned in the link a new version can be obtained at http://slackware.org.uk/slacky/slackware-14.0/utilities/xclip/0.12/
Quirky April 7.0.2 has xclip 0.11. I have now upgraded to 0.12, which will be in 7.0.3.
[url]https://bkhome.org/news/[/url]
To be clear: you referred to a post by Mochi, and in this post Mochi pointsdisciple wrote:I'm assuming when you say "Mochi's reference" that's a slip up?musher0 wrote:Thanks, disciple.
I did read Mochi's reference, but it sounded like Martian, and it made me
grumpy... I'll re-read it with a rested head tomorrow...
to another site. That Internet page sounded like Martian, not yours, not
Mochi's.
Sorry if I offended anyone, English is not my mother tongue, I may use it
in a clumsy manner at times.
BFN.
musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)