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?

34 comments

  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
    1. Re:The 'proper' way by Anonymous Coward · · Score: 0

      (Score -1, Tard Spelling)

    2. Re:The 'proper' way by PeterClark · · Score: 2

      I can't guarantee this for every distro, but I've always been able to use the "right flying window" key (found on just about every American 104-key keyboard these days) as the compose key, right out of the box, so to speak.

      It's just a matter of looking up the sequence and typing it in. For instance,


      [right windows key] + ['] + [e] = é

      [right windows key] + [,] + [c] = ç


      Note that it is not necessary to hold down the buttons; one at a time will do.

      :Peter

    3. Re:The 'proper' way by Anonymous Coward · · Score: 0

      ãnkß fõr ât :)

    4. Re:The 'proper' way by Anonymous Coward · · Score: 0

      You mean "71zz4rD 5p3L1n6"

    5. Re:The 'proper' way by Hack+Shoeboy · · Score: 0

      Which, incidentally, is Shoeboy's password. I recommend that everyone hack him right now.

      --

      IN TEH FUCHAR, LITERSY WLIL EB OPSHANAL!!!!!111
  2. This actually has to be fixed at a lower level by Anonymous Coward · · Score: 0

    The issue of non-English input needs to be fixed at the lowest possible level, as it (rather obviously) applies to so many things above it.

    I should be able to easily type Korean characters on the console, basically, without any wierd non-standard stuff or jumping through funny hoops.

    So, anyone currently working on an input-extender kernel module?

  3. 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

  4. 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: áéíóúñü

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

    read the manpage for xmodmap.

  6. 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.

  7. All-Famous AskSlahdot Next Week: by Anonymous Coward · · Score: 1, Funny

    I have a few questions for you Slashdot wizards:

    1. How do I configure my Linux not to bash at me, everytime I press enter it bashes at me?! My friend's Linux is a bit more friendlier, it just says tcsh tcsh. I could live with that even, I believe.
    2. Which button is number 1, 2 and 3 on my mouse in X desktop?
    1. Re:All-Famous AskSlahdot Next Week: by Anonymous Coward · · Score: 0

      You can get it to give you ksh! For free,too!

  8. Dead keys? by Isle · · Score: 1

    Hello, what's wrong with good ordinary dead keys?

    Dont you americans have dead-keys on your keyboards? Shame on you!

    I have never had problems with accents on linux or unix, except when sitting with a crappy standard US-keyboard. Fortunatly some of the UNIX keyboards has a compose key that does the same.

    Perhaps the question whould be: Is there a way to mark certain buttons on a US-keyboard dead?

    1. Re:Dead keys? by J'raxis · · Score: 1

      All Macintoshes work this way. In the U.S. keyboard layout, which keys are dead is sort of intuitive: its basically the most-common letter that accent would appear over.

      Option-e
      Option-i
      Option-u
      Option-n ~
      Option-` `

    2. Re:Dead keys? by sharkey · · Score: 2

      Dont you americans have dead-keys on your keyboards?

      I know I do. Th third ky from th lft in qwrty is dad on my kyboard, that's why it's so hard to rad what I hav writtn.

      --

      --
      "Outlook not so good." That magic 8-ball knows everything! I'll ask about Exchange Server next.
    3. Re:Dead keys? by Anonymous Coward · · Score: 0
      Dont you americans have dead-keys on your keyboards? Shame on you!

      Hey, I didn't design it. But yeah, I have some dead keys with "Windows" logos on them...

  9. 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

    1. Re:Composing by DarkVein · · Score: 1

      What about typogrpahical characters, like Em Dash (U+2014), En Dash (U+2013), Horizontal Ellipsis (U+2026), and Minus (U+2212)? I've been desiring a way to input these characters for a long time.

      --

      I'm as mimsy as the next borogove but your mome raths are completely outgrabe.

  10. alt-gr by Anonymous Coward · · Score: 0

    For when the regular grrrr just isn't enough. ;0)

  11. Euro by Anonymous Coward · · Score: 0

    That is a very useful table, rikkus; thank you. Now, would you happen to know how to compose the Euro character? I did not see it on your table, but it would be a most useful one now that the Euro is in use throughout Europe.

  12. comprose by dozer · · Score: 1

    Here's some more information on how to use the compose key:

    http://www.trestle.com/linux/xkey/index.html

  13. Mode_shift, dead keys, and xkeycaps by red_dragon · · Score: 2

    I once went through the hassle of setting up my US keyboard in XFree 3.x to emulate Windows' US-International layout (I had become very accustomed to it). One thing I quickly learned is that using Compose is uncomfortably clumsy, and usually didn't work the way I expected it to. That's when I found about XKeycaps, a little X program written using libXaw that allows the user to produce an xmodmap file visually. I eventually did something like this:

    • Assigned Mode_shift to RightAlt (AltGr, if your keyboard has that);
    • Changed the apostrophe to dead_acute, double quote to dead_diaeresis, backtick to dead_grave, asciitilde to dead_tilde, and asciicircum to dead_circumflex;
    • Assigned alternate graphs to various keys, so that they'd work the same way they'd do under Windows when Mode_shift is pressed.

    IIRC, XF4 comes with a "us_intl" layout that is similar ("XkbLayout('us_intl')" in XFree86config, I think), but too many things were different from what I expected that I still kept using my old xmodmap file. It does provide for a good starting point, however; you won't have to do as much with xmodmap as a result.

    --
    In Soviet Russia, Jesus asks: "What Would You Do?"
  14. i "just works" for me by alonsoac · · Score: 1

    I have a spanish layout keyboard so all those keys simply work. I would suppose that there are English+International keyboards that are basically in English but provide such keys?

  15. This actually has to be fixed at a *higher* level by Anonymous Coward · · Score: 0

    Everyone should learn and use English. Then you don't have to worry about non-English characters.

  16. Emacs iso-accents-mode by waynem77 · · Score: 1

    There is of course iso-accents-mode in Emacs. Do "M-x iso-accents-mode" in a buffer and Emacs will combine certain keystrokes into accented characters. For example, the string

    /a /e 'i `o "u
    becomes
    å æ í ò ü