Commit graph

45 commits

Author SHA1 Message Date
Eberhard Beilharz
4a852c9522
chore(linux): rename test files
This change rename the test files for Linux according to the discussion
at the Keyman conference in November 2024.

Python is pretty opinionated about the naming of files, so we have to
use `*_tests.py` as test filename instead of the usual `*.tests.py`.
2024-11-26 19:06:02 +01:00
Eberhard Beilharz
50228a8266
fix(linux): properly deal with types of names
Names can be Unicode strings or byte arrays. This change allows for both
kinds. Also properly deal with the case when we can't get the name from
the .ttf file. And finally change the test so that we don't need the
`KbdKhmr.ttf` font.
2024-08-24 12:16:04 +08:00
Eberhard Beilharz
c8cbc2fefe
fix(linux): get font facename from .ttf file 2024-08-24 11:31:23 +08:00
Eberhard Beilharz
c99e833c8e
fix(linux): Add font name without file extension 2024-08-24 10:25:57 +08:00
Eberhard Beilharz
16ce5b0408
fix(linux): get oskFont from kmp.json instead of UnicodeFont 2024-08-24 10:07:36 +08:00
Eberhard Beilharz
a22a40fe2e
fix(linux): add keymanFacename to .ldml file
This change adds the `keymanFacename` attribute based on UnicodeFont
or AnsiFont to the root element of the generated .ldml file so that
onboard-keyman can display the proper font for the osk.

Fixes: #12019
2024-08-23 22:42:16 +02:00
Eberhard Beilharz
7478db8b57
chore(linux): Fix typo
This suddenly started failing. I guess there was a deprecated
`assertEquals` in older Python libraries, but with the latest version in
Ubuntu 24.04 Noble this disappeared. Anyway, with this change we use
the same assert method as in the other test files.
2024-05-03 17:39:14 +02:00
Eberhard Beilharz
2044b188f8
fix(linux): Improve detection of Gnome environment
This change improves the way we detect if we're running a Gnome based
UI that needs it's keyboards installed under
`org.gnome.desktop.input-sources`. We use the environment variable
`XDG_CURRENT_DESKTOP` and check if it contains the word `gnome`.
Additionally this change renames `is_gnome_shell()` to
`is_gnome_desktop()`.

Fixes #11225.
2024-04-23 15:16:03 +02:00
Eberhard Beilharz
23a558d88e
feat(linux): Deal with temporary dbus session
When we launch dbus if it is not running, we're probably (un-)installing
keyboards for a different user. This is an unusual environment where not
everything is available, e.g. dconf-service won't be running and can't
be started because DISPLAY variable is not set. This means we can't
write gsettings values through the API. However, we can read them, and we
can write a keyfile and update the database. This is what this change
implements for the cases where we started dbus.
2024-03-22 12:54:50 +01:00
Eberhard Beilharz
d396a397e3
chore(linux): Use ibus start if available
IBus around version 1.5.28 introduced the `start` subcommand for `ibus`.
If available we use that because that starts `ibus-daemon` with the
correct arguments. If the available IBus version is too old we use
our previous code where we pass arguments to `ibus-daemon` which might
be different from how ibus gets started on that system otherwise.
2024-02-26 16:34:46 +01:00
Eberhard Beilharz
4bad36089f
fix(linux): Use temp dir if we can't create cache dir
If we can't create the cache dir, e.g. if `~/.cache` doesn't exist or
if we don't have enough permissions, we now return a temporary directory.

Fixes #10033.
2024-02-09 18:01:40 +01:00
Eberhard Beilharz
91e731a955
Merge pull request #9756 from keymanapp/feat/linux/8598_kmconfig
feat(linux): Allow installing keyboards with arbitrary language 🏘️
2023-10-17 18:02:19 +02:00
Eberhard Beilharz
c56b8a72eb
chore(linux): rename parameters
This addresses code review comments.
2023-10-16 09:12:28 +02:00
Eberhard Beilharz
23cc98a690
feat(linux): Allow installing keyboards with arbitrary language 🏘️
- during installation add to the list of custom keyboards if necessary
- during uninstallation remove from the list of custom keyboards
- if list of custom keyboards has invalid values, remove those before
  saving the list

Closes #8598.
2023-10-13 16:57:57 +02:00
Eberhard Beilharz
303e57ba68
refactor(linux): Refactor mocks in ibus-util tests 2023-10-12 18:45:12 +02:00
Eberhard Beilharz
d92808e779
chore(linux): Speed up ibus-util tests 2023-10-12 18:34:50 +02:00
Eberhard Beilharz
152d36a654
fix(linux): Fix installation of keyboards with lang tag mul
We now use the canonical tag without appending the script (unless
necessary).

Fixes #8620.
2023-07-19 12:01:52 +02:00
Eberhard Beilharz
e1dc9574c3
Merge pull request #9215 from keymanapp/chore/linux/newtests
chore(linux): Add unit tests for dconf_util.py
2023-07-13 12:31:26 +02:00
Eberhard Beilharz
8b9f3eb2c5
chore(linux): Add another test 2023-07-11 17:33:46 +02:00
Eberhard Beilharz
847556b176
Merge pull request #9193 from keymanapp/chore/update-data
chore: Update standards data
2023-07-11 08:59:25 +02:00
Eberhard Beilharz
74643d39ed
chore(linux): Add unit tests for dconf_util.py
Tests were generated by ChatGPT (although it didn't get it quite
right - was missing the parameter in `self.settings.reset`).
2023-07-07 18:29:31 +02:00
Eberhard Beilharz
0f8fe48167
fix(linux): Fix Linux build
New langtags.json adds data that a test on Linux uses, so this
change adjust the test.
2023-07-06 19:47:46 +02:00
Eberhard Beilharz
9f5ac8eb4a
fix(linux): Fix uninstalling keyboard for multiple languages with ibus
After this change uninstalling a keyboard will remove all installed
language/keyboard combinations for that particular keyboard.
Previously we only uninstalled for the first language listed in the
keyboard.
2023-07-05 11:57:23 +02:00
Eberhard Beilharz
c6f4541c83
feat(linux): Fix unit tests 2023-05-30 17:51:25 +02:00
Eberhard Beilharz
2fea609714
Merge pull request #8011 from keymanapp/feat/linux/uninstall-if-error
feat(linux): Improve uninstallation
2023-01-25 16:46:56 +01:00
Kevin Schluensen
4c0ede6c4d Change tests to fit install_kmp function 2023-01-20 08:58:14 +01:00
Eberhard Beilharz
efd5200050
chore(linux): More refactoring of uninstall
This change refactors and cleans uninstall:

- rename methods to make it clear which ones are private/protected
- extract common code
- improve error reporting
2023-01-19 18:06:56 +01:00
Eberhard Beilharz
89a253b1ca
feat(linux): Enhance tab completion in km-package-install
This change adds tab completion for the bcp-47 parameter in
km-package-install.

Fixes #5361
2023-01-11 12:28:12 +01:00
Eberhard Beilharz
b1d201a3d7
feat(linux): Replace deprecated distutils
Fixes #6955
2022-08-08 16:38:35 +02:00
Eberhard Beilharz
4c1f6e7be2
fix(linux): Refactor and fix tests
- patch `is_fcitx_running()` so that tests will work without X11
- move common test code to methods
- move some tests to subtests
2022-04-12 12:09:55 +02:00
Eberhard Beilharz
ad2a6b713f
fix(linux): test fileVersion during package install
Fixes #6256
2022-04-11 18:22:46 +02:00
Eberhard Beilharz
c42a623f38
fix(linux): Don't crash when installing keyboards in Wasta
Fixes #6158. This bug got introduced in #6015.
2022-01-27 17:22:02 +01:00
Eberhard Beilharz
2ec64ac521 fix(linux): Fix unit tests 2021-12-09 14:44:33 +01:00
Eberhard Beilharz
a98300f769
fix(linux): Fix failing tests 2021-08-16 11:56:05 +02:00
Eberhard Beilharz
c35e5ff9cc
refactor(linux): Refactor install_kmp.py
- Introduce `InstallKmp` class
- Remove unused `list_files` method
- Extract common method that `install_kmp_shared` and
  `install_kmp_user` use
- Make internal methods protected
2021-05-17 10:58:04 +02:00
Eberhard Beilharz
88e83e191e
fix(linux): Address code review comment
Also add additional test cases from Windows implementation.
2021-02-09 15:51:31 +01:00
Eberhard Beilharz
42f3f36013
fix(linux): improve BCP 47 canonicalization
This is based on #4425. Also a few additional bug fixes that showed
up on the way.
2021-02-08 17:50:05 +01:00
Eberhard Beilharz
693f13a953
fix(linux): Improve fix for #3399
This improves the implementation for normalizing language tags
when installing a keyboard. Based on the Windows implementation
in `Keyman.System.CanonicalLanguageCodeUtils.pas`.

One difference to the Windows implementation is that the mapping of
3- to 2-letter tags is based on `langtags.json` instead of
`iso639-3.tab`.

Closes #3399.
2021-02-03 19:08:03 +01:00
Eberhard Beilharz
9047103028
fix(linux): Lookup language tag from keyboard
When installing a keyboard with a bcp47 tag we now look up the
language tag in the keyboard kmp.json file. This fixes #3399 in
case a script subtag is required for the language and will cause
the keyboard to properly show up in the Linux keyboard selection
list.
2020-07-24 17:54:10 +02:00
Eberhard Beilharz
5ead98dd71
fix(linux): Fix unit tests for beta and stable builds 2020-07-24 08:52:33 +02:00
Eberhard Beilharz
8fbdebc9df
feat(linux): keyman:// protocol handler
This change implements the custom keyman:// protocol handler which
will cause the browser to launch km-config when it encounters a
URL using the keyman protocol.

Related to #3271.
2020-07-23 17:35:26 +02:00
Eberhard Beilharz
78b4187928
fix(linux): Use language from search when installing keyboard
When installing a keyboard install it under the language the user
searched for (if any).

This fixes #3282.
2020-07-20 11:10:05 +02:00
Eberhard Beilharz
071df63ac7
feat(linux): Install keyboard on Gnome
This change adds the keyboard to the Gnome input sources after
installing the .kmx file, and removes it on uninstall.

This implements #2728.
2020-06-24 19:13:40 +02:00
Eberhard Beilharz
fe90bb33eb
chore(linux): Address code review comments 2020-06-17 18:36:13 +02:00
Eberhard Beilharz
16fa9a562f
chore(linux): Add some unit tests for keyman_config 2020-06-17 09:19:19 +02:00