May 10, 2012

Set compose key on Linux | Input character directly by Unicode code.

  1. Compose key:
  2. Sometime during your working time, you wanna/have to input some special, useful and widely used characters such as ©, ® or ó, ⁶, and §ô øñ ...
    It isn't easilly to input those above characters with the default input method or keymap.
    You have to change your own IM (Input Method), keymap or copy&paste those characters from another location to your current input area. Or at least, you also have to set some speacial shorcut in concurrent IM/IE (Input Engineer).
    I think there are many tools, tips to resolve this issue out there. And one of the most easy way is that using Compose Key
    How to setup compose key? I'm working on a Gentoo Linux system. So I will give you some guidelines to setting up and using Compose Key.
    1. Setting up:
    2. Now I will demostrate a simplest way to set compose key on most Linux system which has a running X Window system. If your Linux system has a(n) DE(s) such as KDE or GNOME, you're freely to choose another method using GUI, maybe. I'll cover it later.
      Tool and Command: X Window is come with many tool to modify/customize IM, and keyboard layout. One of them that is setxkbmap. And we'll use this tool to set the compose key. The command is:
      $ setxkbmap -option compose:ralt
      
      • setxkbmap: Tool command.
      • option: setxkbmap Commandline option indicates that the another option is Options :3
      • compose: Indicates that the option is setting Compose Key
      • : <-- Don't miss it!
      • ralt: That means the Compose Key is Righ Alt on your keyboard.
      • You're free to choose another key that you wanna such as rwin means it's the Right Windows key on keyboard.
    3. Usage:
    4. How to use the Compose Key?
      |Compose Key| + |First Char| + |Second Char|
      
      You input those keys sequencially.
      • Compose Key: The Compose Key.
      • First Char: The first character to composing. It's usually a symbol such as ", ', ~, `,... And sometime that is a normal character on the keyboard.
      • Second Char: It's mostly is a normal character. Sometime it's a symbol.
    5. Examples:
    6. Following examples will demostrate how to use Compose Key to input speacial character such as: ®, ©¸ õ, ū, ⁶, ₁.
      ralt o c => © 
      
      ralt o r => ® 
      
      ralt ~ o => õ 
      
      ralt - u => ū 
      
      ralt ^ 6 => ⁶ 
      
      ralt _ 1 => ₁
      
    7. Reference:
    8. Linux Compose Key Sequences

  3. Input directly using Unicode code:
  4. ♥, ♚, ♪, ... Interesting huh? You're surely sometime wanna use these special characters. Example: in some lovely post for your friend on her/his facebook's wall.
    How to input it? Compose Key?
    I think unless use some tips/trick, else, the only/first method to input those special characters is copy&paste
    Yes, we should been copy&paste before, but now, we'll input those characters directly by using Unicode code. Interesting huh?
    1. Requirement:
      • You have to know exactly the Unicode code of the character that you wanna.
      • But, "where could I get it?" I dunno exactly. Err, on Internet, or wherever.
        Recommend: GnuCharMap and KCharSelect are two powerful tool to view, select, ... Unicode character.
      • The font that you're using support the Unicode character that you wanna.
      • I'm write these line with GVim, using unifont, and test on Firefox with Linux Biolinum font. Both of them display those above special character nicely!
    2. Input them:
    3.     Ctrl + Shift + u + Unicode Code
          
      • Description:
      • Hold on both Ctrl and Shift keys, then press the u key on keyboard. Lastly input the Unicode Code exactly, as fast as possible. Then left out Ctrl and Shift keys.
      • Note:
      • Do not left out any of two Ctrl and Shift keys until you're done.
    4. Examples:
    5.     Ctrl + Shift + u + 2665 => ♥
          Ctrl + Shift + u + 266a => ♪