[gnome-shell/wip/carlosg/osk-updates: 169/180] data: Document JSON file format in OSK layouts README file




commit c5c6aacc0f3dba1af5619b5d80925c17283de8e6
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Apr 22 23:52:16 2022 +0200

    data: Document JSON file format in OSK layouts README file
    
    Remove some no longer so relevant information, and add this
    newly relevant information for anyone that wants to add a new
    OSK layout.

 data/README.osk-layouts | 78 +++++++++++++++++++++++++++++++++++++------------
 1 file changed, 60 insertions(+), 18 deletions(-)
---
diff --git a/data/README.osk-layouts b/data/README.osk-layouts
index e9e668f346..a0a0dbea55 100644
--- a/data/README.osk-layouts
+++ b/data/README.osk-layouts
@@ -1,33 +1,75 @@
 Gnome-shell OSK layouts are extracted from CLDR layout definitions:
 https://www.unicode.org/cldr/charts/latest/keyboards/layouts/index.html
 
-Updating these involves several steps:
+To add new layouts from CLDR:
 
-1) Downloading and unzipping the tarball found at:
-   http://www.unicode.org/Public/cldr/latest/keyboards.zip
+1) Run update-osk-layouts.sh
 
-   This file contains XML files describing the keyboard layouts.
+2) Modify JSON files to add extra keys, tweak appearance...
 
-2) Cloning the cldr2json script at:
-   git://repo.or.cz/cldr2json.git
+2) Do git add and git commit
 
-   It will be used to convert the XML files into JSON that can be
-   directly consumed by gnome-shell.
+JSON file format
+================
 
-3) Running the script to produce the files:
-   ./cldr2json <input-directory> <output-directory>
+Each JSON file describes a keymap for a certain language and layout,
+it has the following structure:
 
-   We shall usually use the "android" folder, since that's most
-   complete, and similar to our UI and target sizes. And the target
-   directory must be data/osk-layouts in this repository.
+- Root (Object)
 
-4) Modify gnome-shell-osk-layouts.gresource.xml to include the files
+  Root object of a layout, has the following properties:
 
-5) Do git add on the updated/new files, and git commit.
+  - levels (Array of Level): Levels in the keymap
+  - locale (String): Locale name for this keymap
+  - name (String): Human readable name for this keymap
 
+- Level (Object)
 
-Or alternatively:
+  A level defines the keys available on a keyboard level,
+  these are the key panels visible at a time. E.g. to type
+  uppercase levels or symbols.
 
-1) Run update-osk-layouts.sh
+  Levels have the following properties:
 
-2) Do git add and git commit
+  - level (String): Name of the level, common names are
+    "", "shift", "opt" and "opt+shift".
+  - mode (String): Mode for this level, common modes are
+    "default", "latched" and "locked".
+  - rows (Array of Row): Array of rows of keys.
+
+- Row (Array)
+
+  A row is an Array of Key.
+
+- Key (Object)
+
+  A keyboard key. Keys have the following properties:
+
+  - iconName (String): Icon name to show on the key.
+    Keys with an icon name do not have a label.
+  - label (String): Label to show on the key.
+  - strings (Array of String): Strings to commit. If
+    label property does not exist, the first element
+    will be also the label. Extra elements are shown
+    in the extra keys popover.
+  - keyval (String): Hexadecimal keyval to emit as
+    emulated key presses. Committed strings are
+    preferred.
+  - width (Double): Relative width of the key in the
+    row. 1 is for a square key. Multiples of 0.5 are
+    accepted.
+  - level (Integer): Level that the key switches to.
+    See the levelSwitch action.
+  - action (string): Action performed by the key,
+    accepted actions are:
+
+    - hide: Hides the OSK
+    - languageMenu: Pops up the language selection
+      menu
+    - emoji: Switches to the emoji selection panel
+    - modifier: Handles the keyval as a modifier
+      key. This handles e.g. Ctrl+A as a sequence
+      of Ctrl press, A press, A release, Ctrl
+      release.
+    - delete: Deletes text backwards
+    - levelSwitch: Switches OSK to a different level


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