# How can I remap my keys to act like the Macintosh keyboard (like hold alt l + l click = r click)?

I want my keyboard layout to act like a Macintosh keyboard. It's hard to use my computer after years on a mac.

I want to disable my right mouse click, and replace it with alt + right mouse click.

The alt key will also act like ctrl.

I want my left ctrl to be the HUD key.

I still want my super key to be the same.

Can someone please make a script, or point me in the direction of a program to do all this with ease. If you were to make a script/whatever, can you please make one what will reverse all keyboard changes in-case I feel that it is not the same. I will add to the post if I miss anything.

Thank you.

-
could you clarify what you mean with 'alt key will act like ctrl'? Do you want to rebind alt to ctrl? –  rakete Jul 6 '12 at 1:14
@rakete eg. i do ctrl+c for copy. I want alt+c for copy instead of ctrl. I want to switch ctrl and alt. plus do everything i mentioned above. –  jaorizabal Jul 6 '12 at 2:32
swapping ctrl and alt could be done with xmodmap, it is actually pretty easy but maybe its better you'd ask it again in a seperate question, or take a look at already answered questions if they help you, e.g.: askubuntu.com/questions/93950/cant-remap-ctrl-key-with-xmodmap –  rakete Jul 8 '12 at 14:15

You can use the tool xte to send mouseclicks or keypresses to the X server from the command line. And if you bind that with xbindkeys to alt and left mouse button, then you should have what you want.

First install neccessary packages:

sudo apt-get install xbindkeys xautomation


then create the ~/.xbindkeys config file with the following content:

"xte 'mouseclick 3'"
Alt + b:1


That should run "xte 'mouseclick 3'", which sends a right click to the X server, everytime you press alt + left mouse.

Start the daemon to make it work (use -n for nodaemon mode if you are testing things, so you can easily kill it with Ctrl-C, start without -n to run it in the background):

xbindkeys -n


The sad news is though: it doesn't work. It should, but for me on Ubuntu 12.04 running Unity/Compiz, it does not work, xbindkeys can't intercept mouse button presses. Still, maybe you are luckier or have a config where xbindkeys is able to intercept mouse button presses.

-
here is another guy having problems with xbindkeys and mouse buttons: unix.stackexchange.com/questions/31257/… –  rakete Jul 6 '12 at 1:30
it didn’t work but thanks anyway –  jaorizabal Jul 6 '12 at 2:30

In System Settings, you got two places for options about your keyboard :

• Keyboard Layout to configure the layout of your keyboard (qwerty, azerty, Macintosh, BEPO, ...).
• Keyboard to configure shortcuts on your keyboard (and your keyboard responsiveness too).
-
I tried that already, it doesn’t work perfectly unfortunately. –  jaorizabal Jul 5 '12 at 23:13