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.

using Mac computers for few years, I got accustomed of using the Cmd key on the keyboard as a standard Ctrl key.

With Ubuntu 13.04 on my Macbook Pro 5,3 (2009), the Cmd is used for Unity controls, and Ctrl for applications shortcuts. Is there any way to switch the two keys? So that, as an example, close a tab in Firefox would be Cmd+W instead of Ctrl+W?

share|improve this question
    
Found the answer here : askubuntu.com/questions/131900/… but with 13.04 you must edit an xmodmap file in your /home folder because there is no more a "layout" option in Parameters > System > Keyboard. –  greguti Jul 7 '13 at 16:14
    
If you have solved your problem, it would be helpful to write up your solution as an answer. If you put your answer on askubuntu.com/questions/131900/… and edited the question to cover both versions of Ubuntu then this question could be closed as a duplicate. –  David Edwards Jul 8 '13 at 12:06
add comment

1 Answer 1

I found out a workaround. The solution is to use the xmodmap utility and make it load a personal file with the correct mapping for the keyboard.

  1. Open a terminal and create a new file in your /home folder, lets call it .Xmodmap

    nano .Xmodmap
    

(I use nano as a nice text editor inside the console, you can use Gedit instead, install nano with the command sudo apt-get install nano if you'd like to test it, it's quite obvious to handle.)

  1. Copy/paste the following content to the new file:

    clear control
    clear mod4
    
    keycode 105 =
    keycode 206 =
    
    keycode 133 = Control_L NoSymbol Control_L
    keycode 134 = Control_R NoSymbol Control_R
    keycode 37 = Super_L NoSymbol Super_L
    
    add control = Control_L
    add control = Control_R
    add mod4 = Super_L
    
  2. Make the file executable.

    chmod +x .Xmodmap
    
  3. Test it now with the following command:

    xmodmap .Xmodmap
    

The dash should now appear with CTRL instead of CMD, hurra!

  1. Now we want the file to be executed each time the system starts up. Open the Startup Applications utility and add a new entry, name it as you want and put the following comand in it:

    /user/bin/xmodmap /home/YOURUSERNAME/.Xmodmap
    

Reboot, it should be ok. If it is not, you should add a .xinitrc file in your /Home folder, and add the command inside it. The .xinitrc file will be read by the system while loading the desktop environnement.

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