Scroll-Wheel Copy and Paste: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
There is no standard ability to copy / cut / paste in the [[Terminal]] activity. There's a partial work-around if you have a USB mouse with a scroll-wheel which is also a third button (this setup is the norm).
There is no standard ability to copy / cut / paste in the [[Terminal]] activity. There are several easy ways to achieve this functionality, though. Three different ways are detailed below:


-----------------------------------------------------------------------------------------
If you have something in the paste buffer--for instance if you highlighted a command from a web page by highlighting it and copying with Ctrl-C--you can paste it to the command line.


1) First method: Create a script (works for pasting, but not for copying):
Go to the Terminal, and click the scroll-wheel. It should paste what you have in the paste buffer. Remember that it will always paste it where the current cursor is, the mouse can't move the cursor in Terminal.
http://wiki.laptop.org/go/Ask_OLPC_a_Question_about_the_Network#Copy_and_Paste_into_Terminal_Window


Open a terminal and create a new file called "paste" in the home directory, this can be done with nano for example.
To copy something from Terminal, highlight the text. This effectively puts the highlighted text in a paste buffer. You can then paste it back into Terminal, or into another activity (such as [[Write]] or a web page text box) by clicking the scroll-wheel.


nano paste
This is a poor substitute for proper copy-paste ability, but is very useful when trying to do complicated instructions at the command line.


In the file enter the following
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------


#!/usr/bin/python
The following two methods are also very useful in order to paste into the Terminal window without the need for an external USB mouse (both methods work perfectly fine for pasting into Terminal, although I don't think they work for copying from the Terminal).
import pygtk

import gtk
There's two different ways to paste into terminal without using extra hardware. The first is to create a script that does this. The second method is to remap the right touchpad button as the middle mouse button.
cb = gtk.clipboard_get(selection = "PRIMARY")

print cb.wait_for_text()
1st method (taken from: http://wiki.laptop.org/go/Ask_OLPC_a_Question_about_the_Network#Copy_and_Paste_into_Terminal_Window

Open a terminal and create a new file called "paste" in the home directory. In the file enter the following

#!/usr/bin/python
import pygtk
import gtk
cb = gtk.clipboard_get(selection = "PRIMARY")
print cb.wait_for_text()


Save then make the file executable by typing
Save then make the file executable by typing


chmod a+x paste
chmod a+x paste


Finally to run the script to paste from the clipboard type
Finally to run the script to paste from the clipboard type


./paste
./paste
---------------------------------------------------------------------------------------


2) Second method (works for pasting, but not for copying):

The second method (taken from: http://www.catmoran.com/olpc/
http://www.catmoran.com/olpc/


In order to map the the middle mouse button onto the trackpad's right button, open Terminal and type:
In order to map the the middle mouse button onto the trackpad's right button, open Terminal and type:
Line 50: Line 43:


In order to paste, simply press the right touchpad button.
In order to paste, simply press the right touchpad button.
------------------------------------------------------------------------------------------

3) Third method (works for both pasting and copying, but requires an external USB mouse):

This requires a USB mouse with a scroll-wheel which is also a third button (common setup).

If you have something in the paste buffer--for instance if you highlighted a command from a web page by highlighting it and copying with Ctrl-C--you can paste it to the command line.

Go to the Terminal, and click the scroll-wheel. It should paste what you have in the paste buffer. Remember that it will always paste it where the current cursor is, the mouse can't move the cursor in Terminal.

To copy something from Terminal, highlight the text. This effectively puts the highlighted text in a paste buffer. You can then paste it back into Terminal, or into another activity (such as [[Write]] or a web page text box) by clicking the scroll-wheel.

This is a poor substitute for proper copy-paste ability, but is very useful when trying to do complicated instructions at the command line.

Revision as of 18:16, 16 May 2008

There is no standard ability to copy / cut / paste in the Terminal activity. There are several easy ways to achieve this functionality, though. Three different ways are detailed below:


1) First method: Create a script (works for pasting, but not for copying): http://wiki.laptop.org/go/Ask_OLPC_a_Question_about_the_Network#Copy_and_Paste_into_Terminal_Window

Open a terminal and create a new file called "paste" in the home directory, this can be done with nano for example.

  nano paste

In the file enter the following

  #!/usr/bin/python
  import pygtk
  import gtk
  cb = gtk.clipboard_get(selection = "PRIMARY")
  print cb.wait_for_text()

Save then make the file executable by typing

  chmod a+x paste

Finally to run the script to paste from the clipboard type

  ./paste

2) Second method (works for pasting, but not for copying): http://www.catmoran.com/olpc/

In order to map the the middle mouse button onto the trackpad's right button, open Terminal and type:

xmodmap -e "pointer = 1 3 2"

In order to restore the right trackpad button to default: xmodmap -e "pointer = default"

To make the change persist between reboots, go into root then create a file called ".xsession" in /home/olpc

Add the following to the file:

xmodmap -e "pointer = 1 3 2"

In order to paste, simply press the right touchpad button.


3) Third method (works for both pasting and copying, but requires an external USB mouse):

This requires a USB mouse with a scroll-wheel which is also a third button (common setup).

If you have something in the paste buffer--for instance if you highlighted a command from a web page by highlighting it and copying with Ctrl-C--you can paste it to the command line.

Go to the Terminal, and click the scroll-wheel. It should paste what you have in the paste buffer. Remember that it will always paste it where the current cursor is, the mouse can't move the cursor in Terminal.

To copy something from Terminal, highlight the text. This effectively puts the highlighted text in a paste buffer. You can then paste it back into Terminal, or into another activity (such as Write or a web page text box) by clicking the scroll-wheel.

This is a poor substitute for proper copy-paste ability, but is very useful when trying to do complicated instructions at the command line.