Xcompose key binding

I have installed nomadBSD on USB and then on HDD with no one problem, and do not want to return to Windows nor Linux never again – thank you very much for an excellent distribution and such clear guide online.

I work in historical linguistics, indo-european grammar, so I am looking for Xcompose, which is a part of X.org, included in Xfce, and called as the Compose Key or Multi_key:
https://en.wikipedia.org/wiki/Compose_key

Unfortunately, OctoPkg does not find such keyword ‘xcompose’, ‘compose key’ nor ‘multi_key’ – perhaps because there are nothing to install, only to set ~/.XCompose properly from somewhere in /usr/local/share/X11/xkb/symbols? Sorry, I am not a sysadmin nor a programmer.

The GUI of Xfce keyboard settings I have found on
https://docs.xfce.org/xfce/xfce4-settings/keyboard

And a picture of the Compose key selection:

Hi @vladas,

according to the Arch wiki article, you can proceed as follows:

  1. Get a list of possible compose keys:
    grep "compose:" /usr/local/share/X11/xkb/rules/base.lst
    
  2. Define the compose key by adding -option compose:<your compose key> to the setxkbmap command in ~/.config/xkbdmap.sh
  3. Create ~/.XCompose to define your key combinations. E.g:
    include "%L"
    
    <Multi_key> <g> <a> : "α"
    <Multi_key> <g> <b> : "β"
    <Multi_key> <g> <g> : "γ"
    

Or you could use IBus:

  1. Install IBus and optional IBus engines:
    pkg install ibus
    
  2. Add the following lines to ~/.xprofile:
    export GTK_IM_MODULE=ibus
    export XMODIFIERS=@im=ibus
    export QT_IM_MODULE=ibus
    
    right under the other export lines.
  3. Open Openbox menu -> Settings -> DSBAutostart. Add a new entry for the command ibus-daemon -drx

After logging out and in again, you should be able to use IBus.

I am very impressed by accuracy and clarity of your answer, thanks a lot!

Unfortunately, I was unable to configure and enable Xcompose. ~/.config/xkbdmap.sh contains -rules evdev -layout "lt,us,us" -variant "us,rus,altgr-intl" – what is correct, base.lst is informative, too. After setxkbmap -option compose:ralt in ~/.config/xkbdmap.sh nothing happens: no errors, no effect. I did not find any link to my ~/.XCompose anywhere. I have set this text file of multi key sequences to read and write for all, encoded in UTF-8 with BOM, LF endings. I even answered ralt the last question string of ~/.config/gxkb/gxkb.cfg file: compose_key_position=ralt. Relogin nor reboot did not help. Nor installation of IBus, too.

Sorry for the early question, I will read and investigate docs consistently.

Did you log out and in again after following the steps for configuring xcompose? I forgot to mention that GTK applications require export XMODIFIERS="@im=none" to be set. Add that line to ~/.xprofile right under the other export lines. After logging out and in again, it should work.

I am sorry, I was away for two days. Unfortunately,

export XMODIFIERS=“@im=none”

appended right after

export GIO_USE_VOLUME_MONITOR=unix

in ~/.xprofile did not affect anything. And no new entries appeared in /var/log/messages. I do not know where I should look for errors and warnings. And where ~/.XCompose is linked from some execution file. Will investigate further, I still hope Xcompose in BSD works even better than Wincompose in MS Windows.

BTW, I have found some xkb-related items in /var/log/Xorg.0.log:

INPUT: Adding extenden input device “ACPI video extentions” (type: KEYBOARD, id 13)
Option “xkb_rules” “evdev”
Option “xkb_layout” “lt,us,us”
Option “xkb_variant” “us,rus,altgr-intl”
Option “xkb_options” “terminate:ctrl_alt_bksp”

All looks correctly, only one entry is still missing there, IMHO:

Option “xkb_options” “compose:ralt”

Oh, Xcompose started working! Still not exactly as intended, but it works! Thank you very much for such kind support!

I am trying to figure out why Xcompose started working. It obeyed while writing on this forum, yet I always tested on Leafpad, witch always, and now, still refuses to input extended characters by Xcompose rules. Instead, Mousepad writes correctly, Zim (such a PIM wiki notebook), too. Sorry for disturbing you.

Perhaps I should report what was wrong and how I managed to find a solution. If someone else is interested — Xcompose is a handy tool in everyday work for everyone, not just for linguists, e. g.

<Multi_key> <Multi_key> <b> : "₿" # Bitcoin
<Multi_key> <a> <1> : "Often written my whole sentence."

I moved my keymap with the same name to ~.XCompose from MS Windows and tested it by Leafpad. I failed for three reasons.

  1. Leafpad refuses to accept Xcompose input by default, without warning. Although Leafpad is quite smart, it has an option X input method, accessible by context menu only, and valid until the window is closed. While Mousepad, Zim, MC, even Fish and Sakura write smootly. Not as Gimp and Libre Office. I do not know why, maybe they are not fully unicode compatible. Non-unicode and pseudo-unicode apps in Windows can not accept Wincompose, too.

  2. My nomadBSD does not accept Xcompose input from a keypad, I still have not found a way to fix this yet.

  3. Non-alphanumeric keys should be named verbatim in nomadBSD, e. g.

<Multi_key> <slash> <0> : "∅" # diemeter, not Ø

instead of

<Multi_key> </> <0> : "∅"

as was valid in Wincompose. Verbatim names of those keyboard keys are:

Up, Down, Left, Right (the arrow keys), space, exclam, quotedbl,
numbersign, dollar, percent, ampersand, apostrophe, parenleft,
parenright, asterisk, plus, comma, minus, period, slash, colon,
semicolon, less, equal, greater, at, bracketleft, backslash,
bracketright, asciicircum, underscore, grave, braceleft, bar.

Eventually I have set my desired keymap perfectly, even better than Wincompose was.