Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
Why cant you hightlight with left button and paste it with middle button.. – karthick87 Dec 21 '10 at 13:34
@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
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:

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

If you use Unity, give this a try:

share|improve this answer
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

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 DISTRO main
deb-src 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


share|improve this answer

Your Answer


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.