spiegel-keyman/linux/keyman-config
Eberhard Beilharz fb8ef1fc40
chore(linux): Move some files to keyman-config
Some of the configuration files are useful for other distributions
as well. So this change moves them out of `debian/` to
`linux/keyman-config` so that they will be included in the source
tar ball.

Also remove zero-width space from one file.

Closes #8880.

(cherry picked from commit 749112660d)
2023-06-05 16:50:05 +02:00
..
buildtools chore(linux): Code cleanup 2022-07-15 20:44:47 +02:00
icons chore(linux): Update debian metadata based on Debian repos 2021-01-12 18:38:18 +01:00
keyman_config fix(linux): Display error message for corrupt .kmp file 2023-03-20 21:14:46 +01:00
locale chore(common): Update Fula strings 2023-02-17 08:54:28 +07:00
maninc fix(linux): Fix km-config man page 2021-08-31 08:26:07 +02:00
resources chore(linux): Move some files to keyman-config 2023-06-05 16:50:05 +02:00
tests feat(linux): Replace deprecated distutils 2022-08-08 16:38:35 +02:00
.editorconfig feat(linux): Add i18n for Linux 2020-08-19 19:22:33 +02:00
build-help.sh chore(linux): Consolidate Debian source packages 2021-08-06 11:25:00 +02:00
COPYING license file 2018-05-24 16:53:38 +07:00
createkeymandirs.sh missed createkeymandirs.sh 2018-09-01 12:28:16 +07:00
km-config docs(linux): Add example for keyman:// URL format 2022-11-15 17:35:15 +01:00
km-config.bash-completion fix(linux): fix tab completion for command line tools 2021-06-24 11:47:13 +02:00
km-kvk2ldml refactor(linux): Cleanup import of os.path 2021-08-04 12:24:07 +02:00
km-kvk2ldml.bash-completion fix(linux): fix tab completion for command line tools 2021-06-24 11:47:13 +02:00
km-package-get refactor(linux): cleanup code 2020-06-25 17:04:30 +02:00
km-package-get.bash-completion fix(linux): Remove tab completion warning 2022-04-11 16:30:22 +02:00
km-package-install Merge pull request #7730 from keymanapp/fix/linux/7722_replaceSharedKeyboard 2022-11-18 08:41:46 +01:00
km-package-install.bash-completion fix(linux): Remove tab completion warning 2022-04-11 16:30:22 +02:00
km-package-list-installed docs(linux): Improve help texts 2021-06-30 18:12:28 +02:00
km-package-list-installed.bash-completion [linux] alternative --x options for km scripts 2018-10-08 13:25:03 +07:00
km-package-uninstall docs(linux): Improve help texts 2021-06-30 18:12:28 +02:00
km-package-uninstall.bash-completion fix(linux): respect XDG_DATA_HOME environment variable 2021-06-24 18:56:00 +02:00
Makefile fix(linux): Fix make install 2022-10-12 12:28:46 +02:00
MANIFEST.in chore(linux): Move some files to keyman-config 2023-06-05 16:50:05 +02:00
README.md chore(linux): Move some files to keyman-config 2023-06-05 16:50:05 +02:00
run-tests.sh chore(linux): Add some unit tests for keyman_config 2020-06-17 09:19:19 +02:00
setup.py chore(linux): Fix make install 2022-12-09 12:40:40 +01:00

Linux km-config

Preparing to run

If you are running from the repo or installing keyman-config manually rather than from a package then you will need to:

sudo apt install python3-lxml python3-magic python3-numpy python3-qrcode python3-pil \
    python3-requests python3-requests-cache python3 python3-gi gir1.2-webkit2-4.0 dconf-cli \
    python3-setuptools python3-pip python3-dbus ibus libglib2.0-bin liblocale-gettext-perl

Either python3-raven or python3-sentry-sdk (>= 1.4) is required as well. On Ubuntu 22.04 and later run:

sudo apt install python3-sentry-sdk

To install it on Ubuntu 18.04 and earlier run:

sudo apt install python3-raven

For Ubuntu versions that don't provide python3-raven but instead provide python3-sentry-sdk in a too old version (i.e. Ubuntu 20.04): Install python3-sentry-sdk from packages.sil.org, or install it with pip:

pip3 install sentry-sdk

Run the script ./createkeymandirs.sh to create the directories for these programs to install the packages to.

Also copy and compile the GSettings schema:

cd keyman_config
sudo cp resources/com.keyman.gschema.xml /usr/share/glib-2.0/schemas
sudo glib-compile-schemas /usr/share/glib-2.0/schemas

Standards data file

Running km-config requires a language tag mapping file keyman_config/standards/lang_tags_map.py. This file gets generated during a package build, and also when running make.

Installing manually from the repo

make && sudo make install will install locally to /usr/local.

pip3 help install will give you more install options.

To uninstall you can run sudo make uninstall.

Things to run from the command line

km-config

./km-config

This displays a configuration panel that shows the currently installed Keyman keyboard packages and can download and install additional keyboards.

Buttons

  • Uninstall - uninstall selected keyboard
  • About - show information about selected keyboard
  • Help - display help documentation about selected keyboard
  • Options - display options.htm form for setting keyboard options

  • Refresh - useful if you install or uninstall on the commandline while running km-config.
  • Download - runs DownloadKmpWindow (see below)
  • Install - opens a file choose dialog to choose a kmp file to install and bring up the InstallKmpWindow for more details and to confirm installing.
  • Close - close the configuration panel

Download window

This uses the keyman.com website to install kmps.

Search for a language or keyboard in the search box. Select a keyboard from the list. In 'Downloads for your device' there will be an 'Install keyboard' button for the keyboard for Linux. Click it to download the keyboard and bring up the InstallKmpWindow for more details and to confirm installing.

Secondary-click gives you a menu including 'Back' to go back a page.

km-package-install

km-package-install -p <keyboard package id> install Keyman keyboard package from the keyman.com server

km-package-install -f <kmp file> install Keyman keyboard package from a local .kmp file

km-package-uninstall

km-package-uninstall <keyboard id> uninstall Keyman keyboard package

km-package-uninstall -s <keyboard id> uninstall from shared area /usr/local

km-package-list-installed

km-package-list-installed shows name, version, id, description of each installed keyboard

km-package-list-installed -s shows those installed in shared areas

km-package-list-installed -os shows those installed by the OS

km-package-list-installed -u shows those installed in user areas

km-package-get

km-package-get <keyboard id> download Keyman keyboard package to ~/.cache/keyman

km-kvk2ldml

km-kvk2ldml [-p] [-k] [-o LDMLFILE] <kvk file> Convert a Keyman kvk on-screen keyboard file to an LDML file. Optionally print the details of the kvk file (-p) optionally with all keys (-k).

Building the Debian package

You will need the build dependencies as well as the runtime dependencies above

sudo apt install dh-python python3-all debhelper help2man

Run make deb. This will build the Debian package in the make_deb directory.

Internationalization

Create or update i18n template file

Run

make update-template

This will create or update the file locale/keyman-config.pot.

Add translations for a new language

To add translations for a new language run (replacing de_DE with the desired locale):

cd locale
msginit --locale=de_DE.UTF-8 --width=98 --input keyman-config.pot

This will create the file locale/de.po.

NOTE: Specifying UTF-8 is important if any non-ASCII characters will be used in the translation, i.e. always.

NOTE: This step is not necessary when using Crowdin

Update translations

After strings were added or modified the translated po files need to be updated. For this call, replacing de with the desired locale:

make locale/de.po

Alternatively you can also update all po files at once:

make update-po

NOTE: This step is not necessary when using Crowdin

Compile translations

To create the binary files for the translations, run:

make compile-po

This will create .mo files, e.g. locale/de/LC_MESSAGES/keyman-config.mo.

Testing localization

LANGUAGE=de ./km-config

Debugging unit tests

  • Add the following lines to your workspace settings file (.vscode/settings), or copy docs/settings/linux/settings to .vscode/settings)

    "python.envFile": "${workspaceFolder}/linux/keyman-config/tests/python.env",
    "python.testing.unittestArgs": [
      "-v",
      "-s", "linux/keyman-config/tests",
      "-p", "test_*.py"
    ],
    "python.testing.unittestEnabled": true,
    
  • The tests will show up in the Test Explorer in VSCode and can be debugged there