sailfish-on-fxtecpro1/droid-config-t5

Keyboard map files required

Opened this issue · 34 comments

piggz commented
Keyboard map files required

I'm willing ti help. I'm no Coder but a keyboard map file sounds doable.
I have a qwertz keyboard. Is there somewhere a description how to create such a file?

Sailfish uses XKB layouts, which are relatively complex. See this commit for Gemini PDA as base: NotKit/xkeyboard-config-geminipda@6f15955. I started adapting it, but there is no modified key set for 3rd level yet: sailfish-on-fxtecpro1/xkeyboard-config-pro1@4622de1

Device model has to be set via dconf: https://github.com/NotKit/droid-config-geminipda/blob/master/sparse/etc/dconf/db/vendor.d/geminipda-keyboard.txt

The good news is xkb should allow layouts with dead keys, and thus something like us-intl to type in many different languages.

I will have a look on that next weekend. If I got it right, it look not to hard but quite time intensive.

Sorry, haven't had much time on weekend. I will anyway look into it the next days.

I started to create german qwertz map file. But indeed that's not so easy.
on the Gemini file there are four different states. First is plain key, second is with pressed shift, but I have no clue to what key third and fourth state is assigned to. Any help on that?

Further problem. I'm not a native english speaker and do not exactly know the names for the different symbols. Is there somewhere a key map where you can see what symbol has what name? I have already searched the net for it, but couldn't find something really useful.

First is plain key, second is with pressed shift, but I have no clue to what key third and fourth state is assigned to. Any help on that?

I'm not sure about the Gemini, but on a computer, the additional layers should be as described here ("Maj" is Shift):

About the list, unfortunately I failed to find the table I had with a direct correspondance between xmodmap keycodes (or also called keysyms sometimes) and actual characters. That was really a great resource but I remember it was poorly indexed on websearches, I should definitely have saved it. Not as good, but still, here is a long list of unicode characters, You can use it to find the characters you want to map on the Pro¹, and then copy their unicode (U+xxx) in your clipboard to then search it with Ctrl+F in this list of xkb keycodes. There is also this one, in case it lists different characters (none of the two lists is exhaustive).

If I happen to find the single table combining both, I'll post it here.

For reference, I'm also adding /usr/share/X11/xkb/symbols/us configuration from my computer (using US_international layout), as well as a custom version I made to better suit my needs. If anyone takes over the task to build a US_international layout for the Pro¹, then the keycodes are there (but it will be necessary to redistribute them to the right keys on the Pro¹ file).

us layouts.zip

Building a keymapfile without nowing the names for the symbols is really painful!
But I have now finally found what I was looking for:
http://wiki.linuxquestions.org/wiki/List_of_keysyms

So I can continue and hopefully finish work on the keymap file on the next weekend.

That list is an extract of the last one I linked in my previous message, but none is exhaustive unfortunately. However, for relatively standard layouts, that shouldn't be a big issue.

I will probably try to work on a custom us-intl layout too at some point, but still no Pro¹ here.

I'm an idiot! I completely overread the last link of your post.

I made a proposal with a keymap file. I'm no coder, s I think there will be mistakes in it. Especially regarding the lowest key row. Also I don't really know how to test ist. I copied it to /usr/share/X11/xkb/symbols/fxtec_vndr/
and added a pro1.txt file to /etc/dconf/db/vendor.d/ with this inside:
[desktop/lipstick-jolla-home]
model='pro1'

anyway it isn't recognized.

@popanz please see https://github.com/sailfish-on-fxtecpro1/xkeyboard-config-pro1/blob/master/xkeyboard-config-pro1/symbols/fxtec_vndr/pro1 as minimal example.

As nemo:

dconf write /desktop/lipstick-jolla-home/model \"fxtecpro1\"
dconf write /desktop/lipstick-jolla-home/layout \"us\"

This enables me to type / by holding left Alt instead of arrow key. Arrow key needs to be remapped in kernel first as KEY_FN has keycode larger than 255 and xkb seems to have legacy problems with that.

[Updated for use with Yellow Arrow modifiers (kernel 4.4.153-perf+)]

Temporary hack to get us-intl on SFOS (QWERTY Pro¹ model):

Preamble

xkb layouts are human-readable plain text files, details of every character mapped on the supplied layouts can be checked easily:

Instructions

  1. Copy the URL of the layout you want from the above list, back up the vanilla Pro¹ xkb file, and fetch the new one from gist:
devel-su
cd /usr/share/X11/xkb/symbols/fxtec_vndr/
mv pro1 pro1.back
curl -L -o pro1 <URL of the desired layout from the list above>
  1. Run the following to take the change into account:
exit
dconf write /desktop/lipstick-jolla-home/model \"fxtecpro1\"
dconf write /desktop/lipstick-jolla-home/layout \"us\"
  1. Restart Lipstick:
systemctl --user restart lipstick

Disclaimer

The us-intl layouts currently supplied are not the classic ones usually found on computers, they are based on my humble customized version which adds some special characters on unused levels (see screenshot here for the version with dead keys on levels 1 and 2). They otherwise mostly resemble the original us-intl layouts. Additional classic layouts will be offered soon for those who don't want the extra characters.

There will always be at least two differences with vanilla us-intl layouts because ? and / need to be bound to keys L and P on the Pro¹, respectively. Those characters therefore have to be associated to level 3 since level 2 on alpha keys is used for upper case, i.e., YellowArrow + l for ? and YellowArrow + p for /. Unfortunately, this means ø and ö that normally are on the level 3 of either keys on the us-intl layout of a full keyboard have been moved to level 4, and Ø and Ö that normally are on the level 4 do not exist as direct key combinations anymore. However, they can still be typed using Caps Lock followed by the level 3 lowercase characters (Shift + YellowArrow + l or p).

Note that dead keys do not currently work in SFOS applications, not sure what is missing for that. They do work, however, in sailfish_ubu_chroot, and therefore still have a use on a Pro¹ running SFOS. As a consequence, the layout with AltGr dead keys is recommended if you plan on typing mostly in SFOS applications or if you do not need dead keys easy to reach in sailfish_ubu_chroot. Alternatively, if you want easy dead keys and plan on typing a lot in sailfish_ubu_chroot, the layout with dead keys on levels 1 and 2 is recommended. For instance, the <TLDE> key (between TAB and Q) has levels 1 and 2 set as dead keys on this latter layout, while they are on levels 3 and 4 on the AltGr alternative. Unfortunately the non-dead key characters cannot be combined with alpha keys to type accents, meaning accented letters can only be typed in SFOS applications if they are directly mapped in the layout (for instance, YellowArrow + e for é).

All currently available layouts for the QWERTY Pro¹ with their revisions can be reviewed and compared here.

Any idea if we can use the camera button as a modifier? I failed to find its keycode, not sure how to find keycodes on SFOS since xev is not available. It would be an interesting modifier because it does not require moving the hands and frees thumbs.

For what it's worth, the above layout kinda works in Ubu chroot ran in SFOS. Dead keys work which is very nice. It really behaves like a true desktop us-intl layout, and dead keys are easy to use with a thumb keyboard since this save the need for simultaneous key presses. Unfortunately it seems to work in XFCE4 only, not when running directly Ubu Chromium without the XFCE4

I gladly confirm the yellow modifier key to work as <ralt_switch> after updating to 3.2.1.20.
Based on Kabouiks temporary hack as he called it, i made an adaption for the german QWERTZ layout.

Just follow the procedure in his post above, steps 2 and 3 differ in the following:

  1. Paste this code instead of Kabouiks:
xkb_symbols "de" {
    include "de"

    name[Group1]="Fxtec Pro1 German (de)";

    key <AE12> { [    apostrophe,           grave,           acute,        NoSymbol ] };

    key <TLDE> { [               q,               Q,              at,        NoSymbol ] };
    key <AD01> { [               w,               W,     asciicircum,        NoSymbol ] };
    key <AD02> { [               e,               E,        EuroSign,        NoSymbol ] };
    key <AD03> { [               r,               R,          degree,        NoSymbol ] };
    key <AD04> { [               t,               T,          macron,        NoSymbol ] };
    key <AD05> { [               z,               Z,     doubleacute,        NoSymbol ] };
    key <AD06> { [               u,               U,       braceleft,        NoSymbol ] };
    key <AD07> { [               i,               I,     bracketleft,        NoSymbol ] };
    key <AD08> { [               o,               O,    bracketright,        NoSymbol ] };
    key <AD09> { [               p,               P,      braceright,        NoSymbol ] };
    key <AD10> { [    udiaeresis,     Udiaeresis,      asciitilde,        NoSymbol ] };
    key <AC10> { [            plus,        asterisk,      asciitilde,        NoSymbol ] };
 
    key <BKSL> { [               a,               A,   lessthanequal,        NoSymbol ] };
    key <AC01> { [               s,               S, greaterthanequal,       NoSymbol ] };
    key <AC02> { [               d,               D,           U2300,        NoSymbol ] };
    key <AC03> { [               f,               F,         minutes,        NoSymbol ] };
    key <AC04> { [               g,               G,         seconds,        NoSymbol ] };
    key <AC05> { [               h,               H,           U1E9E,        NoSymbol ] };
    key <AC06> { [               j,               J,        abovedot,        NoSymbol ] };
    key <AC07> { [               k,               K,       ampersand,        NoSymbol ] };
    key <AC08> { [               l,               L,           acute,        NoSymbol ] };
    key <AC09> { [    odiaeresis,     Odiaeresis,       backslash,        NoSymbol ] };
    key <AC11> { [    adiaeresis,     Adiaeresis,      numbersign,        NoSymbol ] };
 
    key <AD11> { [            less,         greater,   guillemotleft,        NoSymbol ] };
    key <AD12> { [               y,               Y,             bar,        NoSymbol ] };
    key <AB01> { [               x,               X,  guillemotright,        NoSymbol ] };
    key <AB02> { [               c,               C,       copyright,        NoSymbol ] };
    key <AB03> { [               v,               V,           U2039,        NoSymbol ] };
    key <AB04> { [               b,               B,           U203A,        NoSymbol ] };
    key <AB05> { [               n,               N,           U002D,        NoSymbol ] };
    key <AB06> { [               m,               M,        Greek_mu,        NoSymbol ] };
    key <AB07> { [           comma,      semicolon,           U02BB,        NoSymbol ] };
    key <AB08> { [          period,           colon,           U200C,        NoSymbol ] };
    key <AB09> { [           minus,     underscore,          endash,        NoSymbol ] };
 
    include "level3(ralt_switch)"

};
  1. after save and exit in nano, replace us with de in second dconf command
dconf write /desktop/lipstick-jolla-home/model \"fxtecpro1\"
dconf write /desktop/lipstick-jolla-home/layout \"de\"
  1. Then restart lipstick with crtl+alt+backspace or

systemctl --user restart lipstick

Thanks for implementing AltGr TheKit! And thanks for your layout Kabouik! I took it and made minor changes to remove dead-keys from first two levels (moved them to Alt-Gr). This makes it so all keys work normally for those used to standard qwerty layouts, but still gives the advantage of available symbols and dead keys with AltGr, so I think this would make a better default English layout (and certainly what I prefer and am used to - I also swapped ¹ and ¡ so now it matches my PC exactly).

The one thing I dont get is what is key AB10? I don't think that functionality is mapped to an actual key.... I'd like to map that to the SYM key if possible...

How about the arrow keys? Can we make AltGr+arrows be PgUp/PgDn/Home/End? AltGr+Del-->Ins? AltGr+Alt-->Super?

And lastly, can we get F1-F12 perhaps by combination of the Fx-key with the number row?

Attached is my keymap...

pro1.us-intl-altgr-dead-keys.txt

I fully agree @enigma9o7 that a layout without dead keys is best for SFOS. I made the version with dead keys before knowing they would not work on SFOS, and kept it still because they work in sailfish_ubu_chroot which is by far what I use the most on my device.

I edited my how-to above to make it more reliable (it should avoid the copy/paste issues we discussed on Discord) and compatible with different layouts when they are available. I believe your version could be added to the list, if you agree we can make a gist with it and include it. I'll also compare it to the classic us-intl without dead keys usually found on computers and, if different, suggest we also offer the classic layouts as alternatives for those who want to stick to widespread layouts (with the exception of ? and / that have to be changed on the Pro¹).

Guys if you are making keyboard layout then don't rewrite keys you are not changing. If you are not changing some key's behaviour just don't type it.

I think I changed all keys at least on some levels in my custom us-intl, but you are right that actually the vanilla qwerty layouts should already be included in /usr/share/X11/xkb/symbols/us, except for / and ? that we can alter in /usr/share/X11/xkb/symbols/fxtec_vndr/pro1. This should be relevant for the default us-intl that I was planning to add for instance.

I'm not sure how to use a specific layout within the us file though. Would the following be enough for the altgr-intl layout for instance?

default  partial alphanumeric_keys

xkb_symbols "us" {
`include "altgr-intl"

    name[Group1]="Fxtec Pro1 English (US, intl., with AltGr dead keys)";

# Keys specific to the Pro¹ keyboard:
    key <AD10> { [           p,                 P,                slash,           odiaeresis ] };
    key <AC09> { [           l,                 L,             question,               oslash ] };

    include "level3(ralt_switch)"
};

Or do we need to reflect it in the dconf write /desktop/lipstick-jolla-home/layout \"us\" command as well?

Oh, I did not see that commit. Yes it is now, but did you not use the layouts posted here? The us-intl with dead keys I proposed is not the original one (it's a version on steroids with extra characters on empty levels of the original us-intl with dead keys).

Now since you included the community layouts and since the altgr-intl seems to be already included in the us file, I guess switching between layouts will be less hacky. Thanks.

@Kabouik to be honest i got confused about which layout to include as there are 3 of them and all of them rewrite all keys so i have no idea what is the difference between them.

also that us layout was before commit.

I was referring to us-intl section in the file (line 73), not us.

From what I can collect (but I am no expert), I think us-intl with dead keys rewrites all keys but most of them are actually new because it is a custom version with extra keys on level 4. There might be a few duplicates that did not need to be rewritten, but most are not duplicates. Same for us-intl with altgr dead keys because @enigma9o7 based it on my custom version of us-intl with dead keys, with the extra characters on level 4, so again there might be some duplicates but not so many. German lists all keys too but I think that was necessary because the keycodes differ from normal keyboards. Russian layout does not rewrite all keys (but Coderus is a lot more skilled than @eLtMosen, @enigma9o7 and I combined, so that was to be expected!).

Actually those possible duplicates were one of my concerns when I decided to describe the fix as "Temporary hack" in the post above, because I was not sure the full rewrite was the most parsimonious way, but still wanted to post it since it was still helping on the short term.

I don't think @enigma907's version (us-intl with AltGr dead keys) is included at the moment, it would be nice to add it because it differs from the default one (it has some extra chars).

Okay so which layouts should we also include?

the current us-intl is @enigma9o7's

It depends if we want the custom versions included by default or if we want interested people to install them manually. My vote would be to include:

If we don't want the custom versions, that is totally fine with me, but the extra characters don't hurt.

I would feel more comfortable if someone more experienced than me could comment too.

On the DE layout, yes it is necessary to rewrite all the keys because like Kabouik mentioned the QWERTZ keyboard is completely different to the QWERTY one since it is not shifted.

Thanks for including our layouts in the commit you linked, much appreciated!

I think it does not hurt to offer all available layouts since they are properly named and people with special demands sure know what they are looking for.

the current us-intl is @enigma9o7's

Then there is an issue on line 77, it should read as follows: name[Group1]="Fxtec Pro1 English (US, intl., with AltGr dead keys)";. Line 79 is also erroneous, but no consequences except a misleading comment.

This version of @enigma9o7's us-intl with AltGr dead keys should be correct.

The other version with non-AltGr dead keys could be included too (but not selected as default), I believe, since dead keys are currently useless in SFOS, but working great in chroot.

I'm not sure this has been picked up, but the things above should be fixed in this PR, plus formatting improvements and an alternate international layout. Some testing would be welcome from Russian or German speakers but it works well for me on Qwerty with US-intl, I've been using this since the PR was submitted with no issue.

piggz commented

Can this be closed?

The map files are on the device now, but the appropriate ones are not automatically selected. I still had to do the dconf dance as described in #13 (comment) despite having set my device to German.

Shall I open a new issue on that one?

Just a short note on a regression i found when flashing the 3.4 build.
In previous builds my qwertz hardware was working out of the box since the correct layout was integrated at some point.
Thanks again for that porters!
Now on 3.4 i see the correct layout is still in /usr/share/X11/xkb/symbols/fxtec_vndr/pro1
But i had to manually do

dconf write /desktop/lipstick-jolla-home/model \"fxtecpro1\"
dconf write /desktop/lipstick-jolla-home/layout \"de\"

and restart lipstick to activate it.