xcompose


Namexcompose JSON
Version 0.5.1 PyPI version JSON
download
home_pageNone
SummaryUtility for managing X11 compose key sequences
upload_time2025-07-17 09:16:14
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords compose key unicode text entry xcompose
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # xcompose

[![PyPi](https://img.shields.io/pypi/v/xcompose)](https://pypi.python.org/pypi/xcompose)
[![License](https://img.shields.io/pypi/l/xcompose)](LICENSE)
[![Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)

Simple utilities to help configure X11 compose key sequences.

> The repo also hosts a very extensive [.XCompose file](Compose) with over 42 000 new sequences; [more details here](Compose.md).

## Installation

```bash
$ pip install xcompose
```

## Requirements

Currently assumes that the system compose key configurations are in `/usr/share/X11/locale/`, while the keysym definitions are in `/usr/include/X11/keysymdef.h`.

Only tested on Ubuntu 24, but should work more widely (though still very much beta quality).

## Usage

```
$ xcompose -h
usage: xcompose [-h] [-f FILE | -S] [-i] [-k KEY] [-s SORT] {add,find,get,validate} ...

XCompose sequence helper utility.

positional arguments:
  {add,find,get,validate}
    add                 print a new compose sequence
    find                find sequences matching given output
    get                 get sequences matching given key inputs
    validate            validate compose config file

options:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  config file to analyze (instead of user config)
  -S, --system          analyze system config (instead of user config)
  -i, --ignore-include  don't follow any include declarations in the config
  -k KEY, --key KEY     modifier key keysym (default is Multi_key; use ANY for all)
  -s SORT, --sort SORT  sort resulting sequences (options: 'keys', 'value')
```

### Examples
```
$ xcompose find é
<Multi_key> <acute> <e>			: "é"	eacute # LATIN SMALL LETTER E WITH ACUTE
<Multi_key> <e> <acute>			: "é"	eacute # LATIN SMALL LETTER E WITH ACUTE
<Multi_key> <apostrophe> <e>		: "é"	eacute # LATIN SMALL LETTER E WITH ACUTE
<Multi_key> <e> <apostrophe>		: "é"	eacute # LATIN SMALL LETTER E WITH ACUTE

$ xcompose find pound
<Multi_key> <L> <minus>			: "£"	sterling # POUND SIGN
<Multi_key> <minus> <L>			: "£"	sterling # POUND SIGN
<Multi_key> <l> <minus>			: "£"	sterling # POUND SIGN
<Multi_key> <minus> <l>			: "£"	sterling # POUND SIGN

$ xcompose find U+00B5
<Multi_key> <m> <u>			: "µ"	mu # MICRO SIGN
<Multi_key> <slash> <u>			: "µ"	mu # MICRO SIGN
<Multi_key> <u> <slash>			: "µ"	mu # MICRO SIGN

$ xcompose get / =
<Multi_key> <slash> <equal>		: "≠"	U2260 # NOT EQUAL TO

$ xcompose --sort keys get /
<Multi_key> <slash> <minus>		: "⌿"	U233f # / - APL FUNCTIONAL SYMBOL SLASH BAR
<Multi_key> <slash> <slash>		: "\\"	backslash # REVERSE SOLIDUS
<Multi_key> <slash> <less>		: "\\"	backslash # REVERSE SOLIDUS
<Multi_key> <slash> <equal>		: "≠"	U2260 # NOT EQUAL TO
<Multi_key> <slash> <B>			: "Ƀ"	U0243 # LATIN CAPITAL LETTER B WITH STROKE
<Multi_key> <slash> <C>			: "₡"	U20a1 # COLON SIGN
<Multi_key> <slash> <D>			: "Đ"	Dstroke # LATIN CAPITAL LETTER D WITH STROKE
⋮
<Multi_key> <slash> <U2194>		: "↮"	U21AE # LEFT RIGHT ARROW WITH STROKE
<Multi_key> <slash> <U2395>		: "⍁"	U2341 # / ⎕ APL FUNCTIONAL SYMBOL QUAD SLASH

$ xcompose add ɕ c @
<Multi_key> <c> <at> : "ɕ"  U0255   # LATIN SMALL LETTER C WITH CURL

$ xcompose add ć c /
<Multi_key> <c> <slash> : "ć"  U0107   # LATIN SMALL LETTER C WITH ACUTE (conflicts with ¢)

$ echo '<Multi_key> <c> <comma> <quote> : "ḉ"' >> ~/.XCompose  # add a line to .XCompose

$ xcompose validate
[/home/Udzu/.XCompose#116] Unrecognised keysym: quote
[/home/Udzu/.XCompose#116] Missing keysym: expected U1E09
[/home/Udzu/.XCompose#116] Missing comment: expected LATIN SMALL LETTER C WITH CEDILLA AND ACUTE
[/home/Udzu/.XCompose#116] Compose sequence Multi_key + c + comma + quote for 'ḉ' conflicts with 
  [/usr/share/X11/locale/en_US.UTF-8/Compose#428] Multi_key + c + comma for 'ç'
    to ignore this, include the string 'conflict' or 'override' in the comment
    
$ xcompose -S validate  # system config isn't validated by default (only parsed for conflicts)
[/usr/share/X11/locale/en_US.UTF-8/Compose#73] Incorrect comment: LESS-THAN, expected LESS-THAN SIGN
[/usr/share/X11/locale/en_US.UTF-8/Compose#74] Incorrect comment: LESS-THAN, expected LESS-THAN SIGN
[/usr/share/X11/locale/en_US.UTF-8/Compose#75] Incorrect comment: GREATER-THAN, expected GREATER-THAN SIGN
[/usr/share/X11/locale/en_US.UTF-8/Compose#76] Incorrect comment: GREATER-THAN, expected GREATER-THAN SIGN
[/usr/share/X11/locale/en_US.UTF-8/Compose#121] Incorrect keysym: guillemotleft, expected guillemetleft (or U00AB)
[/usr/share/X11/locale/en_US.UTF-8/Compose#122] Incorrect keysym: guillemotright, expected guillemetright (or U00BB)
[/usr/share/X11/locale/en_US.UTF-8/Compose#198] Incorrect comment: ROUBLE SIGN, expected RUBLE SIGN
⋮
[/usr/share/X11/locale/en_US.UTF-8/Compose#253] Incorrect keysym: masculine, expected ordmasculine (or U00BA)
[/usr/share/X11/locale/en_US.UTF-8/Compose#4985] Incorrect comment: ○ \ APL FUNCTIONAL SYMBOL CIRCLE SLOPE, expected APL FUNCTIONAL SYMBOL CIRCLE BACKSLASH
[/usr/share/X11/locale/en_US.UTF-8/Compose#4986] Incorrect comment: \ ○ APL FUNCTIONAL SYMBOL CIRCLE SLOPE, expected APL FUNCTIONAL SYMBOL CIRCLE BACKSLASH
```

### Formatting

There is also a separate utility for helping format configs so that definitions line up nicely.

```
$ xcfmt -h
usage: xcfmt [-h] [-o FILE] [-k N] [-v N] [FILE]

XCompose config formating utility.

positional arguments:
  FILE                  file to format (uses stdin if unspecified)

options:
  -h, --help            show this help message and exit
  -o FILE, --output FILE
                        file to write output to (uses stdout if unspecified)
  -k N, --max-key-indent N
                        maximum indentation up to the colon (default: 40)
  -v N, --max-value-indent N
                        maximum indentation up to the comment (default: 10)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "xcompose",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "Compose key, Unicode, text entry, xcompose",
    "author": null,
    "author_email": "Uri Granta <uri.granta+python@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/d4/b5/8b585f61c25c52f056f358ce0dae2d04033f5915890ff7cac0699ca326a3/xcompose-0.5.1.tar.gz",
    "platform": null,
    "description": "# xcompose\n\n[![PyPi](https://img.shields.io/pypi/v/xcompose)](https://pypi.python.org/pypi/xcompose)\n[![License](https://img.shields.io/pypi/l/xcompose)](LICENSE)\n[![Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)\n\nSimple utilities to help configure X11 compose key sequences.\n\n> The repo also hosts a very extensive [.XCompose file](Compose) with over 42\u2009000 new sequences; [more details here](Compose.md).\n\n## Installation\n\n```bash\n$ pip install xcompose\n```\n\n## Requirements\n\nCurrently assumes that the system compose key configurations are in `/usr/share/X11/locale/`, while the keysym definitions are in `/usr/include/X11/keysymdef.h`.\n\nOnly tested on Ubuntu 24, but should work more widely (though still very much beta quality).\n\n## Usage\n\n```\n$ xcompose -h\nusage: xcompose [-h] [-f FILE | -S] [-i] [-k KEY] [-s SORT] {add,find,get,validate} ...\n\nXCompose sequence helper utility.\n\npositional arguments:\n  {add,find,get,validate}\n    add                 print a new compose sequence\n    find                find sequences matching given output\n    get                 get sequences matching given key inputs\n    validate            validate compose config file\n\noptions:\n  -h, --help            show this help message and exit\n  -f FILE, --file FILE  config file to analyze (instead of user config)\n  -S, --system          analyze system config (instead of user config)\n  -i, --ignore-include  don't follow any include declarations in the config\n  -k KEY, --key KEY     modifier key keysym (default is Multi_key; use ANY for all)\n  -s SORT, --sort SORT  sort resulting sequences (options: 'keys', 'value')\n```\n\n### Examples\n```\n$ xcompose find \u00e9\n<Multi_key> <acute> <e>\t\t\t: \"\u00e9\"\teacute # LATIN SMALL LETTER E WITH ACUTE\n<Multi_key> <e> <acute>\t\t\t: \"\u00e9\"\teacute # LATIN SMALL LETTER E WITH ACUTE\n<Multi_key> <apostrophe> <e>\t\t: \"\u00e9\"\teacute # LATIN SMALL LETTER E WITH ACUTE\n<Multi_key> <e> <apostrophe>\t\t: \"\u00e9\"\teacute # LATIN SMALL LETTER E WITH ACUTE\n\n$ xcompose find pound\n<Multi_key> <L> <minus>\t\t\t: \"\u00a3\"\tsterling # POUND SIGN\n<Multi_key> <minus> <L>\t\t\t: \"\u00a3\"\tsterling # POUND SIGN\n<Multi_key> <l> <minus>\t\t\t: \"\u00a3\"\tsterling # POUND SIGN\n<Multi_key> <minus> <l>\t\t\t: \"\u00a3\"\tsterling # POUND SIGN\n\n$ xcompose find U+00B5\n<Multi_key> <m> <u>\t\t\t: \"\u00b5\"\tmu # MICRO SIGN\n<Multi_key> <slash> <u>\t\t\t: \"\u00b5\"\tmu # MICRO SIGN\n<Multi_key> <u> <slash>\t\t\t: \"\u00b5\"\tmu # MICRO SIGN\n\n$ xcompose get / =\n<Multi_key> <slash> <equal>\t\t: \"\u2260\"\tU2260 # NOT EQUAL TO\n\n$ xcompose --sort keys get /\n<Multi_key> <slash> <minus>\t\t: \"\u233f\"\tU233f # / - APL FUNCTIONAL SYMBOL SLASH BAR\n<Multi_key> <slash> <slash>\t\t: \"\\\\\"\tbackslash # REVERSE SOLIDUS\n<Multi_key> <slash> <less>\t\t: \"\\\\\"\tbackslash # REVERSE SOLIDUS\n<Multi_key> <slash> <equal>\t\t: \"\u2260\"\tU2260 # NOT EQUAL TO\n<Multi_key> <slash> <B>\t\t\t: \"\u0243\"\tU0243 # LATIN CAPITAL LETTER B WITH STROKE\n<Multi_key> <slash> <C>\t\t\t: \"\u20a1\"\tU20a1 # COLON SIGN\n<Multi_key> <slash> <D>\t\t\t: \"\u0110\"\tDstroke # LATIN CAPITAL LETTER D WITH STROKE\n\u22ee\n<Multi_key> <slash> <U2194>\t\t: \"\u21ae\"\tU21AE # LEFT RIGHT ARROW WITH STROKE\n<Multi_key> <slash> <U2395>\t\t: \"\u2341\"\tU2341 # / \u2395 APL FUNCTIONAL SYMBOL QUAD SLASH\n\n$ xcompose add \u0255 c @\n<Multi_key> <c> <at> : \"\u0255\"  U0255   # LATIN SMALL LETTER C WITH CURL\n\n$ xcompose add \u0107 c /\n<Multi_key> <c> <slash> : \"\u0107\"  U0107   # LATIN SMALL LETTER C WITH ACUTE (conflicts with \u00a2)\n\n$ echo '<Multi_key> <c> <comma> <quote> : \"\u1e09\"' >> ~/.XCompose  # add a line to .XCompose\n\n$ xcompose validate\n[/home/Udzu/.XCompose#116] Unrecognised keysym: quote\n[/home/Udzu/.XCompose#116] Missing keysym: expected U1E09\n[/home/Udzu/.XCompose#116] Missing comment: expected LATIN SMALL LETTER C WITH CEDILLA AND ACUTE\n[/home/Udzu/.XCompose#116] Compose sequence Multi_key + c + comma + quote for '\u1e09' conflicts with \n  [/usr/share/X11/locale/en_US.UTF-8/Compose#428] Multi_key + c + comma for '\u00e7'\n    to ignore this, include the string 'conflict' or 'override' in the comment\n    \n$ xcompose -S validate  # system config isn't validated by default (only parsed for conflicts)\n[/usr/share/X11/locale/en_US.UTF-8/Compose#73] Incorrect comment: LESS-THAN, expected LESS-THAN SIGN\n[/usr/share/X11/locale/en_US.UTF-8/Compose#74] Incorrect comment: LESS-THAN, expected LESS-THAN SIGN\n[/usr/share/X11/locale/en_US.UTF-8/Compose#75] Incorrect comment: GREATER-THAN, expected GREATER-THAN SIGN\n[/usr/share/X11/locale/en_US.UTF-8/Compose#76] Incorrect comment: GREATER-THAN, expected GREATER-THAN SIGN\n[/usr/share/X11/locale/en_US.UTF-8/Compose#121] Incorrect keysym: guillemotleft, expected guillemetleft (or U00AB)\n[/usr/share/X11/locale/en_US.UTF-8/Compose#122] Incorrect keysym: guillemotright, expected guillemetright (or U00BB)\n[/usr/share/X11/locale/en_US.UTF-8/Compose#198] Incorrect comment: ROUBLE SIGN, expected RUBLE SIGN\n\u22ee\n[/usr/share/X11/locale/en_US.UTF-8/Compose#253] Incorrect keysym: masculine, expected ordmasculine (or U00BA)\n[/usr/share/X11/locale/en_US.UTF-8/Compose#4985] Incorrect comment: \u25cb \\ APL FUNCTIONAL SYMBOL CIRCLE SLOPE, expected APL FUNCTIONAL SYMBOL CIRCLE BACKSLASH\n[/usr/share/X11/locale/en_US.UTF-8/Compose#4986] Incorrect comment: \\ \u25cb APL FUNCTIONAL SYMBOL CIRCLE SLOPE, expected APL FUNCTIONAL SYMBOL CIRCLE BACKSLASH\n```\n\n### Formatting\n\nThere is also a separate utility for helping format configs so that definitions line up nicely.\n\n```\n$ xcfmt -h\nusage: xcfmt [-h] [-o FILE] [-k N] [-v N] [FILE]\n\nXCompose config formating utility.\n\npositional arguments:\n  FILE                  file to format (uses stdin if unspecified)\n\noptions:\n  -h, --help            show this help message and exit\n  -o FILE, --output FILE\n                        file to write output to (uses stdout if unspecified)\n  -k N, --max-key-indent N\n                        maximum indentation up to the colon (default: 40)\n  -v N, --max-value-indent N\n                        maximum indentation up to the comment (default: 10)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Utility for managing X11 compose key sequences",
    "version": "0.5.1",
    "project_urls": {
        "config": "https://github.com/Udzu/xcompose/blob/main/Compose"
    },
    "split_keywords": [
        "compose key",
        " unicode",
        " text entry",
        " xcompose"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "214d5f870ce3c0a971d470066498044dcfccb4dea810ce6fa0caac428707a986",
                "md5": "0380b2355c8a992f01b50c7c2624c227",
                "sha256": "6982d5f47675ff8069ef07343bdb5e30a4d6f9f4d969e538bb352df445af0bde"
            },
            "downloads": -1,
            "filename": "xcompose-0.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0380b2355c8a992f01b50c7c2624c227",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 42169,
            "upload_time": "2025-07-17T09:16:12",
            "upload_time_iso_8601": "2025-07-17T09:16:12.697175Z",
            "url": "https://files.pythonhosted.org/packages/21/4d/5f870ce3c0a971d470066498044dcfccb4dea810ce6fa0caac428707a986/xcompose-0.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d4b58b585f61c25c52f056f358ce0dae2d04033f5915890ff7cac0699ca326a3",
                "md5": "858adefc393fcecb75a411ee21777170",
                "sha256": "7ea3a89ad6063de2293dbbb18cd60847c01517aac54ac9a1f7d28f1062d061de"
            },
            "downloads": -1,
            "filename": "xcompose-0.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "858adefc393fcecb75a411ee21777170",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 641398,
            "upload_time": "2025-07-17T09:16:14",
            "upload_time_iso_8601": "2025-07-17T09:16:14.067625Z",
            "url": "https://files.pythonhosted.org/packages/d4/b5/8b585f61c25c52f056f358ce0dae2d04033f5915890ff7cac0699ca326a3/xcompose-0.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-17 09:16:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Udzu",
    "github_project": "xcompose",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "xcompose"
}
        
Elapsed time: 1.59490s