[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using .XCompose



Sorry if the format looks a mess, but it's a consequence of replying to HTML.

On Tue 07 Jul 2020 at 09:44:38 (+0000), Ajith R wrote:

> I was looking at XCompose(3). Thanks for pointing out the mistake.

It wasn't a mistake on your part. It was pointed out to me that
section 3 has an alias redirecting to the real man page, which is
actually still in the right place, section 5. You just followed that
link. I was worried that you might have been reading a real section 3
man page, most of which are incomprehensible to us mere mortals.

> > As I understand .XCompose, it is designed for "compositing", […]

> I understand that. My letter is in the 'shift' set of
> keystrokes. That was the reason I included it. Moreover, the Compose
> manual page states that 'Each event consists of a specified input
> keysym, and optional modifier states:
> [([!] ([~] MODIFIER)...) | None] <keysym>". '

Sure. But typically, for ordinary letter keys, you would expect each
to have its own keysym when shifted. Thus (using English) you see
definitions sequences like

<Multi_key> <o> <c>                     : "©"   copyright # COPYRIGHT SIGN
<Multi_key> <o> <C>                     : "©"   copyright # COPYRIGHT SIGN
<Multi_key> <O> <c>                     : "©"   copyright # COPYRIGHT SIGN
<Multi_key> <O> <C>                     : "©"   copyright # COPYRIGHT SIGN
<Multi_key> <C> <o>                     : "©"   copyright # COPYRIGHT SIGN
<Multi_key> <C> <O>                     : "©"   copyright # COPYRIGHT SIGN

Obviously, I'm struggling when it comes to your own example as I don't
know how these characters relate to one another. So my examples will
be using Latin characters.

It's perfectly possible to write compositions like these:

<x>                                     : "xx"
<X>                                     : "XX"

where X is shifted x.

You can even have:

<y> <y>                                 : "yes"

but the problem is that whenever you type the key y, the system will
wait for another character to be typed. If you want to type the letter
y, you have to type y y Rubout Rubout. For the letter X, you have to
type X Rubout. Not very satisfactory.

What appears on the right is flexible, but the left part, before the
colon, is more constrained. To repeat myself, you should probably look
at the system file for your own locale (and perhaps others) to see
what they use. My own, /usr/share/X11/locale/en_US.UTF-8/Compose, has
the letters (in both cases) and digits (including <KP_3> as well as <3>,
surprisingly), and punctuation keys by name (<comma> etc). My Compose
key (CapsLock) is <Multi_key>.

I also see keys that I have no idea about how to generate them, like
<Greek_ALPHA> <Cyrillic_GHE> <Arabic_alef> and most of the
Unicode-defined ones. But noticeable is the fact that the *first* key is
almost always <Multi_key> or <dead something or other>. That's because
those few keys become unusable on their own, dead. (There are also 9
oddities that mean nothing to me.)

What I don't see are any modifiers like shift and ctrl. In fact, I
found none in /usr/share/X11/locale/*/Compose on my system. Perhaps
yours do, in which case you can follow their style. I can't help
you there.

> I was just trying to find out the reason why the 'composting' was
> not working. I tried including the modifier name and also without
> it. I tried moving the key to the first layer of keyboard layout
> (without shift or other modifiers). Even that was not working.

I think you're now talking about the /usr/share/X11/xkb/ files,
and overriding them in /etc/. I don't touch those, and can't help you
there. I read them, to help in configuring /etc/default/ files, but
no more than that.

> So, I
> was wondering if there was a syntax error in the way I was
> specifying my requirement. I understand the use of Compose key. But,
> I was not trying the usual 'composting' (by means of a compose
> key). I  want one character to be replaced with its geminate form
> whenever it is typed. If the keyboard layout specification allowed
> more than one character for a keystroke, I wouldn't have needed
> it. Hence the need for Compose mechanism. A similar approach is
> explained here https://dominiko.livejournal.com/20206.html . However
> in it, the author has defined a personal use Unicode character, but
> I use one of the Unicode defined characters.

If you're willing to lose the normal function of the key, then as
shown above, you can turn any keystroke into a string.

> In the symbol file, he had used key
> <AD01> { type[group1] = "FOUR_LEVEL_C_HWERTY", [ UF8FD, UF8FE, UF8FF, Greek_alpha ] };
> I didn't understand the use of type[group1 = "..."], but thought
> that it was not essential. Anyway, the layout is working as expected
> in that the characters returned by layout is as defined.

No idea about that stuff.

> The compose mechanism is not working.

Syntax errors are one possibility. I don't know how and when they are
handled. Another is making changes have any effect. (In the past,
I've edited the file in a VC, and started X from another VC after any
changes have been saved.)

A third is that every recipe at the left side must not entirely
include any other. Hence:

<Multi_key> <minus> <minus> <minus>     : "—"   U2014 # EM DASH
<Multi_key> <minus> <minus> <period>    : "–"   U2013 # EN DASH

and not:

<Multi_key> <minus> <minus> <minus>     : "—"   U2014 # EM DASH
<Multi_key> <minus> <minus>             : "–"   U2013 # EN DASH

> I copied one line from your keyboard configuration file and
> my keyboard file looks like this now :

> # KEYBOARD CONFIGURATION FILE
> XKBMODEL="pc105"
> XKBLAYOUT="in"
> XKBVARIANT="eng"
> XKBOPTIONS="lv3:ralt_switch,compose:caps,terminate:ctrl_alt_bksp"
> 
> BACKSPACE="guess"

I should have said that the usual way to write this file is to run
# dpkg-reconfigure keyboard-configuration
(and that command can also be run after editing it in order to
validate/correct it). I should also add that in my experience,
it's best done in a VC, without an X session even running.

(In systemd, there's also this mysterious command
# service keyboard-setup restart
about which I know nothing. I've never used it.)

> and my .XCompose file now is 
> include "%L" 
> <Multi_key> <s> <x>                     : "✄"   U2704 # WHITE SCISSORS
> 
> However, when I press Caps Lock followed by s and then x or if I
> keep the Caps Lock pressed while I press s and x in sequence, I
> don't get scissors. I get S and X.

That appears to indicate that CapsLock is not your Compose Key, but is
behaving as normal, turning s and x into S and X.

> So, my computer's  compose mechanism is not working. Is there
> something wrong in what I am doing or am I missing something? Other
> than creating the .XCompose file in the home folder, should I tell
> the system in some way that the compose mechanism should be
> activated? (BTW, I tried restarting the computer after the change). 
> 
> I am running Debian 10, KDE Plasma  5.14.5, 64 bit

I have no idea how a DE interacts (interferes) with any normal
linux/X system's configuration or behaviour. Sorry.

Cheers,
David.


Reply to: