Slashdot Mirror


Adding Character Accents in XFree86?

debrain asks: "How does one access accent characters (such as tilde, grav, acute, etc.) over normal characters in XFree86? I am quite good with Linux, X, and the like, but I have never found a *good*, *simple* way to do this. Some programs have post-character keystrokes, such as 'a' followed by 'alt-g' or some such, but is there a consistent way to do this, without hacks such as 'dead keys' in XFree86?" A system-wide facility for entering such chars would be a nice thing, if it does exist, then please share the info. Most apps have their own handling for these special characters. What applications do have keystrokes that allow you to easily add character accents, and if you were to design a system-wide handler for such, how would you do it?

6 of 34 comments (clear)

  1. The 'proper' way by Yarn · · Score: 3, Informative

    As I understand it, compose

    Compose should generally be bound to the alt-gr key,
    but the keyboard in XF4+ is incredibly broken for non-US layouts.

    By 'broken' I mean 'different from 3.x' :p

    Another problem is programs grabbing the alt key for their own uses, so even when you can type an extended character, it may be grabbed as a command

    --
    -Yarn - Rio Karma: Excellent
  2. Keymap by bromba · · Score: 1, Informative

    Use X11's keymap facility. By selecting appropriate keymap from the predefined ones, or tweaking one to fit your personal taste, you can solve your problem system-wide.

    I use this approach for inputting latin-2 characters. I don't have the map here at work, but I recall tweaking one of the keymaps to support "Polish programmers" keyboard, where the Polish diacritical characters are input by holding one of the meta-keys and hitting one of the "regular" characters. I think the default input method was using dead keys, but I hate it, so I changed that

  3. I have a page on doing this by Anonymous Coward · · Score: 1, Informative
    I have a page on doing this; it covers Spanish characters:

    http://www.samiam.org/typing.spanish.characters.ht ml

    E.G: áéíóúñü

  4. I would by unhooked · · Score: 2, Informative

    read the manpage for xmodmap.

  5. Ideally ;-) by Sam+Lowry · · Score: 3, Informative

    Ideally, you need only two commands:

    export LANG=en_UK.UTF-8
    xsetkb us_intl

    and then, you will be able to input
    the accented chars by typing `a or a`
    or e' or `e -- it all dependa on your
    particular system.

  6. Composing by rikkus-x · · Score: 5, Informative

    To enter characters that aren't on your keys, you probably want to use the 'compose' method. This is part of X, so it works for all apps. Once you start using it, you can forget about app-specific hacks.

    First you need to decide which key(s) will be used for composing. I have <> keys, so I use them, but you may want to use something like AltGr if you have a typical PC keyboard.

    To find the code generated by a key, run xev and then press the key. On my keyboard, pressing the right 'alt' key generates code 113.

    Now you need to tell X to use this key as a compose key, using something like this:

    xmodmap -e 'keycode 113 = Multi_key'

    After doing this, pressing the compose key and then a combination of other keys will generate the characters you're after. For example: Compose + e + " generates ë (lowercase e with an umlaut).

    Now you may add the above xmodmap invocation to your ~/.xinitrc or ~/.xsession or both, to have the setting ready when you next log in.

    I have tried to tabulate all the available compositions for iso-8859-1 (latin-1) on my website, here.

    Rik