Compose(5)
๐ Compose(5) โ the X client mapping glow-up ๐
okay so bestie, gather round, because this is the manual page for Compose from the File Formats Manual section (section 5, iykyk), and it's genuinely iconic once you get it. It's all about "X client mappings for multi-key input sequences" โ like, the receipts for how your keyboard pulls off the fancy-character magic โจ
๐ธ NAME ๐ธ
Compose โ X client mappings for multi-key input sequences. literally that's the whole vibe. ๐ฆ
โจ DESCRIPTION โจ
so the X library, libX11, ships a super simple input method for characters that go beyond what's actually printed on your typical keyboard. the way it works is you type a sequence of key strokes and they get combined into one single character. no cap, it's giving chef's kiss. ๐
the compose file is searched for in this exact order, bestie, don't skip steps:
- if the environment variable
$XCOMPOSEFILEis set, then its value is used as the name of the Compose file. that's the main character right there. ๐ - if the user's home directory has a file named
.XCompose, that's your girl, she gets used as the Compose file. - otherwise the system provided compose file is used, by mapping the locale to a compose file from the list in
/usr/share/X11/locale/compose.dir.
Compose files can use an "include" instruction, and honestly this is the slay part โ it lets you make local modifications to existing compose files without copy-pasting all of the content directly. for example, the system's iso8859-1 compose file can be included with a line like this:
include "%S/iso8859-1/Compose"
there are several substitutions you can make in the file name of the include instruction, and they're all little icons:
%Hexpands to the user's home directory (the$HOMEenvironment variable) ๐%Lexpands to the name of the locale specific Compose file (i.e.,"/usr/share/X11/locale/<localename>/Compose")%Sexpands to the name of the system directory for Compose files (i.e.,"/usr/share/X11/locale")
for example, you can include in your compose file the default Compose file by using:
include "%L"
and then rewrite only the few rules that you need to change. new compose rules can be added, and previous ones replaced. obsessed. ๐ซถ
๐ FILE FORMAT ๐
Compose files are plain text files, with a separate line for each compose sequence. comments begin with # characters. each compose sequence specifies one or more events and a resulting input sequence, with an optional comment at the end of the line:
EVENT [EVENT...] : RESULT [# COMMENT]
each event consists of a specified input keysym, and optional modifier states:
[([!] ([~] MODIFIER)...) | None] <keysym>
okay now the caveats, listen up because this is where people mess up:
- if the modifier list is preceded by
"!"it must match exactly. no wiggle room, bestie. ๐ MODIFIERmay be one ofCtrl,Lock,Caps,Shift,AltorMeta.- each modifier may be preceded by a
"~"character to indicate that the modifier must not be present. - if
"None"is specified, no modifier may be present. periodt.
the result specifies a string, keysym, or both, that the X client receives as input when the sequence of events is input:
"STRING" | keysym | "STRING" keysym
Keysyms are specified without the XK_ prefix. (yes, drop it. it's a nickname situation. ๐)
Strings may be direct text encoded in the locale for which the compose file is to be used, or an escaped octal or hexadecimal character code. Octal codes are specified as "\123" and hexadecimal codes as "\x3a". it is not necessary to specify in the right part of a rule a locale encoded string in addition to the keysym name. if the string is omitted, Xlib figures it out from the keysym according to the current locale. i.e., if a rule looks like:
<dead_grave> <A> : "\300" Agrave
the result of the composition is always the letter with the "\300" code. but if the rule is:
<dead_grave> <A> : Agrave
the result depends on how Agrave is mapped in the current locale. ๐ that's the difference, don't forget it!
๐ฆ ENVIRONMENT ๐ฆ
XCOMPOSEFILEโ File to use for compose sequences. your pick, your rules. ๐XCOMPOSECACHEโ Directory to use for caching compiled compose files. it's giving efficiency. โก
๐ FILES ๐
$HOME/.XComposeโ User default compose file ifXCOMPOSEFILEis not set./usr/share/X11/locale/compose.dirโ File listing the compose file path to use for each locale./usr/share/X11/locale/<localemapping>/Composeโ System default compose file for the locale, mapped viacompose.dir./var/cache/libx11/compose/โ System-wide cache directory for compiled compose files.$HOME/.compose-cache/โ Per-user cache directory for compiled compose files.
๐ฅ SEE ALSO ๐ฅ
XLookupString(3)XmbLookupString(3)XwcLookupString(3)Xutf8LookupString(3)mkcomposecache(1)locale(7)- Xlib - C Language X Interface ๐
quick vibe check before you go: everything above is exactly as the page says it, so don't come for me if you skip the "!" exact-match rule and your compose breaks. read the caveats, bestie. ๐ญ๐
and that's the whole page, you ate that ๐ โ this was X Version 11, libX11 1.8.14, dated with the Compose(5) manual page. mwah, go forth and compose your little hearts out ๐โจ๐
๐ฆ where this page comes from
- alpine 3.24: libx11-doc 1.8.14-r0 ยท X11
- arch rolling: libx11 1.8.14-1 ยท MIT AND X11
- Copyright (c) 2009, Oracle and/or its affiliates
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms