Subject: Re: bug#40273: installer: No way to input Latin characters with non-Latin keyboard layouts

From: Bengt Richter <[email-masked]>
Date: Wed, 8 Apr 2020 09:20:18 +0200

Hi Florian,

On +2020-04-04 01:17:50 +0200, pelzflorian (Florian Pelz) wrote:
> On Fri, Apr 03, 2020 at 01:27:43AM +0200, Bengt Richter wrote:
> > I think I saw that PureOS was able to handle
> > different-layout keyboards in different concurrent sessions -- different keyboards and displays
> > can be attached to different "seats" -- or something like that, I obviously don't know much yet ;-)
> > 
> > Anyway, to the point: even if I'm wrong about PureOS handling concurrent
> > different-layout keyboards, I think that would be a good goal
> > for GuixOS/Hurd/Shepherd to implement.
> 
> From what I understand from
> <https://github.com/xkbcommon/libxkbcommon/blob/master/doc/quick-guide.md>,
> there can be per-device keyboard layouts, but they are not handled by
> XKB options.  If a device specifier were added to the keyboard-layout
> constructor, the device specifier would need to be turned into
> appropriate xorg.conf MatchUSBID or similar.
> 
> Regards,
> Florian

Sorry for the delay in replying.

Thanks for the informative link!

I'm really against pursuing any new design dependencies on X,
so even "or similar" sounds iffy to me. Just IMO ;-)

I recognize it will be a while before we can ignore X-based apps, but we can stop
using it as GUI infrastructure, if Wayland can provide GUI foundation with Xwayland
giving X apps a path to the screen via Wayland. Of course Wayland has dependencies
on what the kernel can provide, like libdrm stuff.

Wayland seems a likely X successor, and represents an
opportunity to do GUI without X dependencies, for a cleaner Guix.

I can report that tilix as implemented in PureOS on a Librem13v4 provides
a workable GUI solution for multiple keyboards, even if it's not what I had in mind ;-)

Here is an overview:

PureOS is debian-based Purism variant with gnome for desktop etc and I think
all composited and displayed by their Wayland, providing xwayland only as a
service for apps needing the X interface, but not itself depending on X.

tilix is, I think, a pure wayland client implementation, and can provide
multiple simultaneous terminal tiles on the screen, overlapping or not.

These window tiles are created by typing "tilix" with optional args.
Without args it creates a new tile space according to a Default "profile"
which you can do a LOT with, but don't need to to demo the keyboard mappings.

The first tilix command will normally be typed into a widget that comes up
on pressing the super key (some keyboards will have a windows flag on that key :).
Subsequent tilix commands can be typed in any tilix terminal, and will produce another
terminal tile accordin to parameters in the profile (of which you can create different versions).

Choosing a keyboard language (separate dropdown widget at top of screen) in any
of these terminal tiles that has focus will set the keyboard mapping for that terminal
tile only. Switching focus to another tile will use the the kb mapping chosen for it.
Persistence is attached to the terminal tile.

So you could have two different language keyboards plugged in and use one to type
into one tile terminal and the other for the other. You just have to switch focus
to where you want the typing to appear.

But this is also a kind of illusion, because both keyboards' untranslated keycodes
are apparently merged into the same stream and fed where the focus is.

So you can't mix languages on one terminal tile by just typing on the alternate keyboard
(as I had wanted)-- you have to go to the language choice widget and temporarily switch
there, no matter which keyboard you are typing on.

Some keys are obviously the same, so it doesn't matter which keyboard you type those on.
It goes to the focused tile and gets translated, but the mapping
for those keys is the same.

Right now I am in GUI emacs called as editor for mutt, and the language selection has no effect
even though when I exit all the way back to the bash where I typed mutt, it will (or should ;).

pidparents      ?        18587 Ss   /usr/bin/bash /home/bokr/bin/pidparents
emacs           pts/0    18069 Sl+  emacs /home/bokr/.mutt/temp/mutt-LionPure-1000-17715-4020479191039126306
sh              pts/0    18068 S+   sh -c emacs '/home/bokr/.mutt/temp/mutt-LionPure-1000-17715-4020479191039126306'
mutt            pts/0    17715 S+   mutt
bash            pts/0    13623 Ss   /bin/bash
tilix           ?        13618 Sl   /usr/bin/tilix --gapplication-service
systemd         ?         1644 Ss   /lib/systemd/systemd --user
systemd         ?            1 Ss   /sbin/init splash

And if I were at the tty initial console, the widget for language change wouldn't be there, since no gnome GUI.
I would have to use loadkeys. And back in grub, another world. And back in the BIOS, another.
And all considerations repeated for booting from external disks, net, whatever. Phooey ;-)

There's gotta be a better way :)
That "joke" enthusing about a Mach microkernel sounded good :)
-- 
Regards,
Bengt Richter