Tutoriais/Tecla Compose

From KDE UserBase Wiki
Revision as of 23:58, 28 October 2010 by MarcusGama (talk | contribs) (Created page with "=== Configuração do KDE 3.x ===")

Usar/Configurar a tecla Compose

Inrtodução

A tecla compose é usada para inserir caracteres usando um teclado que não dispões normalmente de algumas teclas específicas. Algumas destas teclas podem ser um "umlaut", um "macron" ou acentos em letras:

Este tutorial foi testado em diversos sistemas com o Kubuntu Hardy Heron 8.04.1. Mais informações podem ser encontradas na seção de Links e informações adicionais abaixo.

As modificações funcionarão em (quase) todos aplicativos, incluindo o ambiente de trabalho, navegadores, OpenOffice.org, bem como muitos aplicativos do console ou baseados em texto.

As instruções a seguir irão configurar uma tecla compose, que será mapeada para a tecla do logotipo direito (na maioria dos teclados, este logotipo é o do Windows).

Configuração do Console

Para fazer isto eu estou tentando usar o "modo holístico" inciando com o console:

  • Reconfigure o console para o teclado usado e a codificação de caractere. Para fazer isto em um terminal de texto ou console.
$ sudo dpkg-reconfigure console-setup
  • Siga os passos a seguir na configuração:
    • Selecione seu teclado (aqui teclado US padrão de 104 teclas)
    • Se você deseja a substituição da tecla !AltGr, selecione uma
    • Selecione que tecla você desejaria que fosse a tecla compose a ser mapeada. Use a tecla do logotipo direito.

      Eu preferiria usar a tecla do logotipo esquerdo, mas ela não está disponível na configuração do console. Mas no ambiente gráfico (KDE Plasma) isto é possível.

    • Selecione a codificação do console, definindo-a para UTF-8
    • Selecione que caractere deve estar disponível no console. Eu uso Combined - Latin; Slavic Cyrillic; Hebrew; basic Arabic

      Eu acho que esta seleção deve me fornecer os caracteres que eu quero.

    • Selecione que tipo de saída no console você gostaria (faça o que quiser, é seguro aceitar os padrões atuais)
    • Um novo disco de RAM inicial para a próxima inicialização será criado agora.

Configuração do KDE 3.x

Now we can go on and configure our windowing environment. This description uses either Kcontrol or the Kubuntu configuration tool, which exposes the same option dialogue.

  • Start the System Settings or the KDE Control Center
  • Regional & Language (for System Settings) or Regional & Accessibility (for Control Centre) -> Keyboard Layout
  • Choose your keyboard layout
  • Modify the <menuchioce>Xkb Options</menuchioce> to select/enable the compose key



KDE SC 4.x configuration

Now we can go on and configure our windowing environment (Plasma). This description uses the System Settings as they're available in the K-Menu of the Kubuntu install:

  • Start the System Settings
  • Regional & Language</menuchioce>
  • Select the <menuchoice>Keyboard Layout configuration
  • Under the Layout tab, select Enable keyboard layouts
  • Modify Advanced options to select/enable the compose key



Configuration for Gtk Applications (Gnome, FireFox, etc.)

Gtk (such as also FireFox) and Gnome applications use (on an Ubuntu system) usually SCIM as the input method, not XIM (X Input Method) that relies on the configurations from (X)Compose. Therefore, you will often find that the "a" and "o" macron characters can yield the female/male ordinals "ª" and "º". To still make it work, Gtk applications need to be "told" to use XIM instead.

"One Off" Configuration

For a single application you can do it by just setting the environment variable GTK_IM_MODULE for the application to be launched to xim:

$ GTK_IM_MODULE=xim firefox

More permanently that can be done for a single shell session like this:

$ export GTK_IM_MODULE=xim

This can, of course, also be persisted for a single user in your ~/.bash_profile, or for all users in /etc/environment. This is, however, the less elegant way, the more elegant way follows below.

Persistent Configuration

  • Copy the setup file /etc/X11/xinit/xinput.d/default to /etc/X11/xinit/xinput.d/xim
$ sudo cp /etc/X11/xinit/xinput.d/default /etc/X11/xinit/xinput.d/xim
  • Edit the file /etc/X11/xinit/xinput.d/xim and set the input method for GNOME and KDE to xim
...
 GTK_IM_MODULE=xim
 QT_IM_MODULE=xim
 ...
  • Create a link for the locale all_ALL (or the desired locale only):
$ sudo ln -sf /etc/X11/xinit/xinput.d/xim /etc/X11/xinit/xinput.d/all_ALL

If you are using a Debian-derived distribution use following instead

$ sudo update-alternatives --verbose --install /etc/X11/xinit/xinput.d/all_ALL xinput-all_ALL /etc/X11/xinit/xinput.d/xim 20
  • After a restart of the X server everything should work.

Optional Tweaking of XCompose Map

Now that you're using XIM, you can further tweak the XCompose input map for further characters, or for characters in more convenient locations, etc.

To do that follow these steps:

  • Create a ~/.XCompose file, and put the following lines into it:
# ~/.XCompose
 # This file defines custom Compose sequences for Unicode characters
# Import default rules from the system Compose file: include "/usr/share/X11/locale/en_US.UTF-8/Compose"
# To put some stuff onto compose key strokes: <Multi_key> <minus> <greater> : "→" U2192 # Compose - > <Multi_key> <colon> <parenright> : "☺" U263A # Compose : ) <Multi_key> <h> <n> <k> : "hugs and kisses" # Compose h n k <Multi_key> <less> < p> : "< p>

" # Compose < p
  • Just log out and in again (no restart necessary), and you can use your new "multi key short strokes" using the compose key to your desire. As you see this even works for creating longer character sequences.

Typing Macrons, Umlauts, Accents, ...

The compose key will be now whatever you have configured it to be, e. g. right logo.

  • Macrons
compose + shift + hyphen then <vowel >

or

compose + underscore then <vowel >

-->

āēīōū ĀĒĪŌŪ


  • Umlauts
compose + shift + <single quote> then <vowel >

or

compose + <double quotes> then <vowel >

-->

äëïöü ÄËÏÖÜ


  • The German Ess-Zet ligature
compose then s and s (twice the "s")

-->

ß


  • More bindings can be found in /usr/share/X11/locale/en_US.UTF-8/Compose

Links and Further Information