Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Often I'm copying and pasting pieces of text. I'd like to streamline the process.

Anyone know if it possible to bind (for example): Ctrl Right Click to Copy and Alt Right Click to Paste

share|improve this question
2  
Why cant you hightlight with left button and paste it with middle button.. –  karthick87 Dec 21 '10 at 13:34
1  
@karthick87: this should be an answer ;) –  Takkat Dec 21 '10 at 13:43
    
@Takkat He is asking for binding mouse buttons.. –  karthick87 Dec 21 '10 at 13:48
add comment

3 Answers

up vote 1 down vote accepted

Yes, it is possible, and there are many ways to do it.

The easiest way, which isn't exactly what you want, is to use a clipboard manager to bind middle-clicking to pasting. Glippy, which I use, allows me to do this. It has a setting that makes anything you highlight automatically copied to the clipboard and whatever is in the clipboard pasted by midle clicking. I'd don't use this because it's incredibly annoying, but the option is there. Glippy: https://launchpad.net/~bikooo/+archive/glippy

To do exactly what you want you can use xte. Xte is part of the "xautomation" package:

sudo apt-get install xautomation

Assuming you're using Compiz, open the Compiz Config Manager. Go to the "Commands" section, then enter something like this as a command:

xte 'keydown Control_L' 'key c' 'keyup Control_L'

The go to the "Button Bindings" tab and map the command to Ctrl+Button3.

Now holding Ctr and pressing the right mouse button will act as pressing Ctrl+C.

To also get this behavior in a terminal the command would be:

xte 'keydown Control_L' 'keydown Shift_L' 'key c' 'keyup Control_L' 'keyup Shirt_L'

To learn more about how to emulate key presses with xte type

man xte

Into a terminal after you install xautomation.

share|improve this answer
add comment

It could be done using btnx

If you can't find it in your repos then

Put the following lines to the end of your /etc/apt/sources.list file, but replace DISTRO with the name of the Ubuntu distro you have installed (options: feisty gutsy hardy):

deb http://ppa.launchpad.net/daou/ubuntu DISTRO main
deb-src http://ppa.launchpad.net/daou/ubuntu DISTRO main

then to install it

sudo apt-get update && sudo apt-get install btnx

After installation go to Applications -> System tools -> btnx

click detect mouse & buttons (if not already detected) follow the steps when done go to buttons select the ones you want to bind and then from keycode drop-down list choose KEY_COPY and KEY_PAST

Enjoy

share|improve this answer
add comment

If you use Unity, give this a try:

http://thecodecentral.com/2012/07/27/use-mouse-buttons-to-perform-copy-paste-in-ubuntu

share|improve this answer
1  
You should provide step by step instructions here, not simply direct to a link. By the way, prerequisite is compiz, not Unity. –  Eric Carvalho Nov 28 '12 at 6:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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