Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to configure and use Compose sequences in XFree86 4.3
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
grant.mcdorman
Apprentice
Apprentice


Joined: 29 Jan 2003
Posts: 295
Location: Toronto, ON, Canada

PostPosted: Sat May 10, 2003 5:19 pm    Post subject: How to configure and use Compose sequences in XFree86 4.3 Reply with quote

Introduction
XFree86 has several ways of entering special characters (such as accented characters or special punctuation). I'm going to show you how to set up one of them, compose sequences, for a US-style keyboard. (The other methods include third-level shift keys, dead keys and input methods.)

Compose Sequences
Compose sequences are three-key sequences used to enter special characters. A particular key is set as the compose key; you then press, in sequence, the compose key followed by two other keys to enter a special character. For example, pressing Compose, e and then ^ will produce ê (e accent circumflex). Note that you do not press all the keys together; rather, each key is pressed and released in turn. The full set of compose sequences for the ISO8859-1 character set [Latin1] is too large to include here: there are 108 unique characters that can be generated, and multiple sequences for each character, with a total of about 450 sequences. The listing of the compose sequences can be found in /usr/X11R6/lib/X11/locale/iso8859-1/Compose. They're designed to be reasonably mnemonic and flexible. The order is usually unimportant; that is, you can press the second and third key in any order (i.e. Compose,e,^ or Compose,^,e will both produce ê).

How to Set It Up For All Users
To enable compose sequences for all users, you'll need to edit two files. The first is /etc/profile, where you'll need to set the environment variable LC_ALL:
Code:
#  needed by XFree86 for keyboard en_US to support Compose sequences
LC_ALL=en_US
export LC_ALL

You can use other locales such as en_CA or en_UK if you prefer; for myself, since I'm in Canada I use en_CA. (As far as I know all of the en_* locales have the same set of compose sequences.)

The second is /etc/X11/XF86Config. Find the keyboard section:
Code:
Section "InputDevice"
    Identifier "Keyboard1"
    Driver "keyboard"

In this section, modify (or add, if necessary) the XkbLayout line to read:
Code:
    Option "XkbLayout" "en_US"

You'll also need to choose a key to use as the Compose key. Your choices are the right Alt key, the right Windows key, or the Menu key; this will be an option of compose:ralt, compose:rwin, or compose:menu, respectively. I choose the Menu key. I also set the Caps Lock key to be a control key:
Code:
    Option "XkbSymbols" "ctrl:nocaps,compose:menu"

The complete list of options is in /etc/X11/xkb/rules/xfree86.lst. Look here if you want to find the option for a third-level shift key or to swap Caps Lock and Control, for example.

Restart the X server, log in, and try it out. You should be able to use the compose sequences in most applications (a few very old applications might not work, though).

How To Set It Up Per User
This requires you to run a script when the user signs in. Unfortunately, what that script might be depends on the login manager you're using. For KDE, you can add scripts to ~/.kde/Autostart or ~/.kde3/Autostart; for other login managers it may be ~/.xsession.

In any event, you will want to run, or add, this code:
Code:
#  needed by XFree86 for keyboard en_US to support Compose sequences
LC_ALL=en_US
export LC_ALL
# set up keyboard options
setxkbmap -layout en_US -option "ctrl:nocaps,compose:menu"

As before, adjust the LC_ALL and options to your personal preferences.

You can put this bit of code in its own shell script file and place it someplace convienient, e.g. /usr/local/bin or your KDE Autostart folder, by adding
Code:
#!/bin/sh
to the beginning and making it executable (chmod +x file).

Log out and log back in and compose sequences should be working.
Back to top
View user's profile Send private message
9-speed
Tux's lil' helper
Tux's lil' helper


Joined: 09 Oct 2003
Posts: 98
Location: Delft, The Netherlands

PostPosted: Fri Mar 05, 2004 7:53 pm    Post subject: Reply with quote

When I try your suggested alteration of
Code:
Option "XkbSymbols" "compose:ralt"

to the XF86Config file, it crashes on restarting X and pressing a key. When I do this
Code:
Option "XkbOptions" "compose:ralt"

it works! séé :)

I'm using XFree 4.3
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum