Left Alt combinations with xmodmap

How I can change Alt+symbol to some other ?

For example,

I changed semi-colon like this:

keycode 47   = BackSpace colon semicolon colon semicolon colon

But I want Alt+; to produce ;.


Solution 1:

Keep in mind that xmodmap is sort of deprecated, and will have problems --- for example, the keyboard is re-set on each layout change (that sometime happens when you didn't even think); the file ~/.Xmodmap can be loaded or not depending on your Desktop and DM (display manager). You see more detailed info in this answer and a more "modern" way of making the change in this blog post by myself.

Nevertheless, if you have just one layout maybe xmodmap can work for you, as it seems from your post... so:

  1. Find the keycode of your "+" key; for example, in my laptop with US intl keyboard:

    [:~] % xmodmap -pke | grep plus     
    keycode  21 = equal plus equal plus multiply division
    keycode 126 = plusminus NoSymbol plusminus
    

xmodmap -pke will dump your full keyboard map, and the grep is there to filter just the keys that define "+", which is called "plus" in this case (and I have it on shift-=).

  1. To have a colon on AltGr++, you can feed to xmodmap the line:

     keycode  21 = equal plus equal plus semicolon colon
    

This will use as a modifier the keys which is defined as AltGr in your keyboard layout. In my keyboard it is the Right-Alt key, but YMMV.