Skip to main content

Utility for managing X11 compose key sequences

Project description

xcompose

PyPi License Ruff

A simple utility to help configure X11 compose key sequences.

Installation

$ 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 | tee -a ~/.XCompose   # NB tee -a appends to .XCompose
<Multi_key> <c> <slash> : "ć" U0107    # LATIN SMALL LETTER C WITH ACUTE

>>> xcompose validate  # (assuming .XCompose contains an 'include "%L"' line)
[/home/Udzu/.XCompose#35] Compose sequence Multi_key + c + slash for 'ć' conflicts with Multi_key + c + slash for '¢'
    to ignore this, include the string 'conflict' or 'override' in the comment

>>> xcompose --ignore-include validate  # (no conflicts if we ignore the system file)

Sample .XCompose file

Link: https://github.com/Udzu/xcompose/blob/master/Compose

This repo currently also hosts my personal .XCompose file, which contains extensive additions to the default config focusing on mathematics, linguistics and general text entry. Note that this is not distributed with the xcompose utility: it might be in future, or I might move it elsewhere.

Amongst other characters, the configuration supports:

  • Maths: ρ(∂v⃗/∂t + (v⃗·∇)v), ∫πeⁱᶿ dθ, ∃ A.A ⊊ B∖A, ⊨ P ⊃ ◇P, etc.
  • IPA : ⫽ˈɹɛ.dɪt⫽, [aɪ̯ pʰiː eɪ̯], etc.
  • Latin script: Spın̈al Tap, ʇᴉppǝɹ, Zǎ̺̣͆̚l⃪ğ̶̍ö̱̰̥̂̃, etc.
  • Other scripts: Ρέντιτ, Ре́ддит, ⁧רֶדִיט⁩, ⁧رِيدِيت⁩, 「レヂィット」, 레딧, ⠗⠫⠙⠊⠞, etc.
  • Emoji: 😉 👌🏾 🇳🇿 🫡 👉🏼 💔 🤣 🤦🏽‍♀️ 🏳️‍⚧️ ✨ (and many more)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xcompose-0.1.0.tar.gz (50.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xcompose-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file xcompose-0.1.0.tar.gz.

File metadata

  • Download URL: xcompose-0.1.0.tar.gz
  • Upload date:
  • Size: 50.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for xcompose-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9f770d49a7fdacd2a67896c99a05bb6aaa798ebf639db4bb28a133e3e3808eb2
MD5 98ee0baa6ab44e356dbd04c57efc6c1f
BLAKE2b-256 f73bfe18535b5bca84af3e45b39c2c4792b198b4ef7f84036878517d790f1ed5

See more details on using hashes here.

Provenance

The following attestation bundles were made for xcompose-0.1.0.tar.gz:

Publisher: deploy.yaml on Udzu/xcompose

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xcompose-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xcompose-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for xcompose-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bdc27c58fca16dd140743a135a7d33c659abd0c608cd25001c9887eda36d005f
MD5 d1c17429bec4fe01fd29b8160810b313
BLAKE2b-256 227eff293012a8fabe3c2ae74eda3bb6194bd13c32bf92ead13b3ff45a4b6aa6

See more details on using hashes here.

Provenance

The following attestation bundles were made for xcompose-0.1.0-py3-none-any.whl:

Publisher: deploy.yaml on Udzu/xcompose

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page