Swap/Remap Ctrl and Alt keys.......Finally

Mario Vukelic mario.vukelic at dantian.org
Mon Jun 9 06:57:49 UTC 2008

On Sun, 2008-06-08 at 18:10 -0500, Young wrote:
> Thanks Mario for the info on xkeycaps.
> I have it working the way I want it to now.

You are welcome :)

> One thing that has changed is that you don't have to add it to a 
> startup/login script. If you restart after saving the change in 
> xkeycaps, when you log back in a window pops up asking what you want to 
> do with the .xmodmap file you've created. Just select the file, not the 
> backup, and from then on it runs at login. 

Interesting, thanks.

> It seems to be usual in Ubuntu, for 
> programs and utilities to not tell you their name, nor give you a way to 
> find it.

What do you mean? I don't think this is the case, maybe we can clear
something up?

> Regarding xkeycaps still. There were a couple of things that left me 
> wondering.
> It shows a message saying you need to add a line to a login script to 
> contain:
> xmodmap~/.xmodmap-`uname-n`

xmodmap ~/.xmodmap-`uname -n`
       ^ <-space ^ <-space

> with a note that ` is a back quote.
> First I don't know what ~ means, and there's no way I know of to google 
> that. From the context, and knowing where it saved the change file I'm 
> guessing that ~ means /home/username. Is that the case, and is it always so?

Exactly, ~ is always short for the user's home directory

> Second, what do the back quotes mean? Do they simply indicate that uname 
> should be changed to the correct users name? Would they be required as 
> part of the syntax? And why is there a -n inside the back quotes?

"uname" is a command. "-n" is an option to uname, which makes it print
the computer's hostname. Try "uname -n" on the command line to see what
it does. For me, it prints "chronic"

The back quotes mean that the output of the "uname -n" command shall be
used in the file name. Thus, without all the shortcuts, the above
command is (on my pc)

xmodmap /home/mario/.xmodmap-chronic

Back quotes are a pretty old way to write this command, and people often
get them wrong because they use the wrong characters. An equivalent way
is to write $(uname -n) which has the same affect and is a bit easier to
write and to read.

All that said, according to the man page, xmodmap simply needs a
filename as in put. I think all the -`uname -n` business can be left out
and it will still work.

> This has been a very frustrating experience, and a real eye-opener. It 
> took me 5 days to solve this. On WinXP it took me less than 20 minutes, 
> from the time I thought of it, until it was accomplished. And that was 
> finding a program to do it which I had never used before, (AutoHotKeys), 
> downloading it, reading the documentation, writing the script, and 
> setting it to run at startup. And I didn't need anyone's help.

YMMV. I have set up several things that were a breeze in Ubuntu, but
either seemed impossible to do in Windows without buying shareware (or
programming a solution) or were much more complicated. It all depends on
what you are more familiar with.

It might not have helped you, because your Alt/Ctrl switch was not part
of the options, but keep in mind that Ubuntu's default keyboard layout
options are much more comprehensive that those in Windows (does Windows
even have such a tool?)

You might want to open a wishlist bug for gnome-keyboard-properties in
Launchpad and ask for inclusion of an Alt/Ctrl switch option:

More information about the ubuntu-users mailing list