Skip to content

Custom Keyboard Naming Convention

JanneEdelman edited this page Jan 22, 2014 · 15 revisions

INTRODUCTION

Jolla is really unlike other phones and Sailfish in Jolla is unlike other operating systems in other phone makes. Support for custom keyboards is also unlike in other operating systems. Technically Jolla and Sailfish support custom keyboards but there is no sandbox specificly reserved and pointed for custom keyboards and thus any custom keyboard file is waiting to be in collision with system keyboard files provided by Jolla and break system software updates.

Some keyboard layouts may also need addon fonts to support glyphs present in keyboard and to support writing with the keyboard. Fonts suffer same possibility of conflict than custom keyboard layouts, too.

A SOLUTION TO AVOID COLLISIONS

There is no solution accepted Jolla or solution widely adopted in community to avoid collisions with system files and thus this document will be more like proposal and try out to propose possible solution until Jolla will give developers a sandbox for custom keyboard layouts and addon fonts.

KEYBOARD LAYOUT AND QML FILE DIRECTORIES

There is only one directory for keyboard layouts, /usr/share/maliit/plugins/com/jolla/layouts. This directory contains QML keyboard layout files with naming convention LANGUAGE_CODE + '.qml'. Example: fi.qml

Same directory contains also file layouts.conf which lists all keyboard layouts to be loaded in format:

[de.qml]
name=Deutsch
languageCode=DE

QML code implementing actual keyboard functionality is located in directory /usr/share/maliit/plugins/com/jolla. Basic keyboard layouts won't requite any chances but standard keyboard funtionality may not support all features needed for some keyboards.

Emoji keyboard needed solution to fit almost 850 different symbols into same keyboard with customiced keyboard buttons and functionality

In such cases there is no other option than to install custom code for custom functionality to be called from layout file. A solution to avoid collisions with future system files will be needed.

CUSTOM SOLUTION

It might be very unlikely that Jolla would name any of their keyboard files or folders with name starting with prefix custom or Custom. Thus this could be used for custom keyboard setups with lesser propability for conflict and breakage of SSU.

It would be recommended to create own folder for other custom files (QML, Javascript, etc.) a custom keyboad requires. Custom folder should be located under folder /usr/share/maliit/plugins/com/jolla and it is recommended to follow naming convention custom_NAME for folder and NAME + * + '.qml' for the files in folder, where NAME is name of custom layout and * can be anything convenient for the need, preferably descriptive. Example: folder custom_emoji, file EmojiSymbolKey.qml.

Adding new keyboard layouts to layouts.conf would alter system file and possibly break SSU. Even if SSU would survive from this the added keyboard layout would be disabled after SSU update or system package reinstallation. Fortunately layout configuration(s) can be listed in any file with name ending to .conf> suffix. Layout configurations are processed in alphabetical order of filenames and that allows custom layouts defined in custom .conf files to located either to beginning or end of the keyboard selection list.

Recommendation for naming convetion for custom layout configuration file is '@'|'§' + 'custom_' + LAYOUT + '.conf', where @ is used to place custom layout before system keyboard layout(s) and § to place custom layout after system keyboard layouts. Examples: §custom_emoji.conf or @custom_ar.conf, where the first one places Emoji keyboard in keyboard selector after all system keyboard layouts, and latter one places Arabic keyboard before any system keyboard layouts in keyboard selector.

Sample file structure of The Emoji Keyboard v0.2:

/usr/share/maliit/plugins/com/jolla/
/usr/share/maliit/plugins/com/jolla/custom_emoji/
/usr/share/maliit/plugins/com/jolla/custom_emoji/EmojiSymbolKey.qml
/usr/share/maliit/plugins/com/jolla/custom_emoji/EmojiSetSelectKey.qml
/usr/share/maliit/plugins/com/jolla/custom_emoji/EmojiKbdSelectKey.qml
/usr/share/maliit/plugins/com/jolla/custom_emoji/EmojiEnterKey.qml
/usr/share/maliit/plugins/com/jolla/layouts/
/usr/share/maliit/plugins/com/jolla/layouts/§custom_emoji.conf
/usr/share/maliit/plugins/com/jolla/layouts/custom_emoji.qml