Commit graph

784 commits

Author SHA1 Message Date
Eberhard Beilharz
b80dbf5a6b
fix(linux): replace dbus-x11 dependency 🍒
When using a different DBus implementation `dbus-launch` might not exist,
but instantiating a `SessionBus` object might start a session dbus if
it's not already running. This change also replaces the `dbus-x11`
dependency with `default-dbus-session-bus | dbus-session-bus` and changes
the way we detect if dbus is already running.

Also remove `DBUS_SESSION_BUS_ADDRESS` from `sudo gsettings` call. It
turns out we don't need this since we execute the `gsettings` command
in the context of the user anyway which connects to the user's session
dbus.

Cherry-pick-of: #14895
Fixes: #14888
Test-bot: skip
2025-10-07 16:29:59 +02:00
Eberhard Beilharz
373c02b7d1
fix(linux): don't crash on invalid languages in keyboard 🍒
Fixes: #14748
Fixes: KEYMAN-LINUX-8Q
Cherry-pick-of: #14760

# User Testing

**TEST_INSTALL**: open `km-config` and install a keyboard. Verify that
the keyboard gets added to the list of installed keyboards in `km-config`
as well as to the languages dropdown in the taskbar.
2025-09-17 15:10:00 +02:00
Eberhard Beilharz
c3487e964d
fix(linux): don't crash if kmp.json is missing keyboards section 🍒
Some keyboards seem to be missing the `keyboards` section in the
`kmp.json` file. This change prevents a crash and instead returns `None`
and thus we don't create a .ldml file and so onboard will show the
default keyboard instead. The alternative would be to create an empty
.ldml file, but that causes onboard to show a keyboard with all key caps
being empty.

Cherry-pick-of: #14708
Fixes: #14707
Fixes: KEYMAN-LINUX-8P
Test-bot: skip
2025-09-09 16:32:36 +02:00
Eberhard Beilharz
95e594c1fa
maint(linux): fix lintian warnings
This addresses comments from Debian review of the package.

Cherry-pick-of: #13904
Test-bot: skip
2025-08-22 16:55:08 +02:00
Eberhard Beilharz
d1b74d0175
chore(linux): fall back to package id
This change addresses a code review comment. In the case where the kmp
doesn't contain a name, we now use the `packageID` instead.
2025-04-03 15:56:07 +02:00
Eberhard Beilharz
5df36c05a4
fix(linux): fix crash if kmp doesn't have name field
Fixes: #13647
Fixes: KEYMAN-LINUX-80
2025-04-02 18:20:11 +02:00
Eberhard Beilharz
5ccbb65be2
chore(linux): some more replacements of setup.py
The recommended replacement for `setup.py build` is to use the `build`
module, so we have to add this as additional build dependency.

This change also removes the `devdist` target from the makefile - it
isn't referenced in any script, so I think we can do without.

Unfortunately the `python3-build` package available on Ubuntu 22.04 Jammy
is buggy and looks for `/usr/local/bin/python` so we can't use that.
Instead we continue to use `setup.py` for building on Jammy.
2025-03-18 19:57:37 +01:00
Eberhard Beilharz
3346a31115
chore(linux): replace deprecated setup.py
Now that we no longer support Focal we can move to more modern ways of
installing `km-config`. This change removes the deprecated use of
`setup.py` and replaces it with `pip3 install`.

Fixes: #13319
2025-03-17 18:41:25 +01:00
Marc Durdin
f7bed1d2f6 chore(common): update tests where region data has been added
The 2025-02-18 release of langtags.json includes tag data for sa-Latn
and he-Latn, so tests related to those tags now need to account for
region.

Fixes: #13288
2025-03-10 09:33:01 +07:00
Darcy Wong
1380597be2
Merge branch 'beta' into chore/common/crowdin-vi 2025-03-05 19:45:39 +07:00
Eberhard Beilharz
097a416a06
Merge pull request #13363 from keymanapp/fix/linux/13282_fcitx5-configtool
fix(linux): ignore exception when fcitx5-configtool is not found
2025-02-27 17:14:20 +01:00
Eberhard Beilharz
788e778645
Merge pull request #13356 from keymanapp/fix/linux/12902_UninstallException
fix(linux): ignore DBusException during install and uninstall
2025-02-27 15:28:52 +01:00
Eberhard Beilharz
d90b718aa5
fix(linux): ignore exception when fcitx5-configtool is not found
Fixes: #13282
Fixes: KEYMAN-LINUX-7S
2025-02-27 11:12:30 +01:00
Eberhard Beilharz
a35c6b3c29
Merge pull request #13355 from keymanapp/refactor/linux/tests
refactor(linux): extract method for setting up mocks in tests
2025-02-27 08:37:20 +01:00
Eberhard Beilharz
6fe916ca8b
fix(linux): ignore DBusException during install and uninstall
Fixes: #12902
Fixes: #13283
Fixes: KEYMAN-LINUX-7J
Fixes: KEYMAN-LINUX-7R
2025-02-26 18:24:27 +01:00
Eberhard Beilharz
a4492963e9
refactor(linux): improve dbus_util.py code 2025-02-26 17:19:09 +01:00
Eberhard Beilharz
3e09884c68
chore(linux): adjust to renamed xdg module
The `xdg` module got renamed to `xdg_base_dirs`. However, Ubuntu still
ships the `python3-xdg` package with the old module, so we'll have to
support both so that it'll work with both Ubuntu packages and in a
virtual environment.
2025-02-26 12:14:00 +01:00
Eberhard Beilharz
615d90765c
refactor(linux): extract method for setting up mocks in tests 2025-02-26 12:01:54 +01:00
Darcy Wong
1a1056ca50 chore(common): Add crowdin strings for Vietnamese 2025-02-22 07:37:36 +07:00
Marc Durdin
d6e7c0b9d1 chore: Revert "Merge branch 'master' into beta"
This reverts commit fae3932e15, reversing
changes made to 793daddb48.
2025-02-14 07:45:28 +07:00
Eberhard Beilharz
f1b32a1439
chore(linux): additional code cleanup after Focal removal 2025-02-12 12:21:49 +01:00
Eberhard Beilharz
248f01f1e3
chore(linux): change SIL International to SIL Global 2024-12-10 10:26:44 +01:00
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
a15a005648
fix(linux): set environment variable for rendering of downloads dialog
This works around a problem in webkit2gtk where the download dialog
sometimes only renders a blank screen. Setting the environment variable
seems to help, not only in the cases that the issue describes (with a
NVidia graphics card), but also in my testing in a VM.

Fixes: #12587
2024-11-04 18:53:18 +01:00
Eberhard Beilharz
0688c43253
fix(linux): properly check for missing dependencies
The previous implementation didn't work because the import of
`download_and_install_package` happened before we checked for the missing
dependencies and so the program crashed. This change fixes this and now
does the imports after checking for the missing dependencies so that we
can display an error message to the user.

Also fix a warning.
2024-11-04 18:10:19 +01:00
Marc Durdin
0e5fbb225d refactor(common): fixup help path script references
Relates-to: #12347
2024-09-16 06:19:14 +07:00
Eberhard Beilharz
5b570517b1
fix(linux): display error and abort if fonttools are missing 2024-08-28 16:14:17 +07: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
6bfa8a438f
refactor(linux): cleanup API of kvk2ldml.py
Make methods private that are only used inside of kvk2ldml.py.
2024-08-23 22:40:31 +02:00
Darcy Wong
83f46c8e5e chore(common): Update localization for Greek Polytonic 2024-08-07 05:59:35 +07:00
Eberhard Beilharz
2599487187
fix(linux): set local directory if not specified
If the user specifies just an output file without directory name, we
will now use the current directory instead of crashing.
2024-07-26 12:18:24 +02:00
Eberhard Beilharz
07a2cb5bad
Merge pull request #11852 from keymanapp/feat/linux/7697_SimulateAltGr
feat(linux): implement Linux side of SimulateAltGr option 🏁
2024-06-26 12:34:08 +02:00
Eberhard Beilharz
582ccbec11
fix(linux): ignore exceptions trying to install cache
Using the cache when getting data from the server is just an optimization
to speed up things. However, things still work if we don't use the cache.
This change therefore catches the AttributeError that sometimes happen
on some machines for unknown reasons and falls back to not using the
cache.

Fixes: 11855
Fixes: KEYMAN-LINUX-6R
2024-06-24 18:13:28 +02:00
Eberhard Beilharz
3c800ed65a
feat(linux): implement UI part of SimulateAltGr option 2024-06-21 18:24:02 +02:00
Eberhard Beilharz
2b7d74f4b6
refactor(linux): add KeymanOption class for options 2024-06-21 18:08:56 +02:00
Eberhard Beilharz
64515b025b
feat(linux): re-create missing files at run-time
This changes re-creates the `<package>.bmp.png` as well as the
`<package>.json` files if they are missing when `km-config` starts.

- `<package.bmp.png` gets created from a `.bmp` or `.ico` file included
in the package, similar to what happens when installing the keyboard.
- `<package>.json` gets created from downloaded metadata, similar to
the installation.

If the files are missing or we can't write to the directory, e.g. if it's
the shared area, we skip the re-creation.

Fixes: #9396
2024-06-14 18:11:11 +02:00
Eberhard Beilharz
a5b9321fde
refactor(linux): make method private and change variable names 2024-06-14 15:58:21 +02:00
Eberhard Beilharz
40aa8b8646
Merge pull request #11356 from keymanapp/chore/linux/fixtest
chore(linux): Fix typo
2024-05-06 11:34:35 +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
Marc Durdin
cd8121ef65 chore(common): builder scripts now use /resources/build/builder.inc.sh
Note: there is a bit of potential confusion about the difference between
/resources/builder.inc.sh (the full implementation for builder scripts),
and /resources/build/builder.inc.sh (the source script that builder
scripts should always use).

This allows us to make assumptions that will always be true for builder
scripts that may not be true for other scripts, such as setting base
folder.
2024-05-02 15:54:31 +07:00
Marc Durdin
0f390d47cc chore(common): maintenance on build scripts - cd
Fixes #11324.

* Always `cd "$THIS_SCRIPT_PATH"`
* Remove unnecessary `cd` from all build.sh
* Remove unnecessary `set -eu` from all build.sh (and `# set -x`)
* Replace old build-utils.sh incantation in a few build.sh scripts
2024-05-02 15:54:29 +07:00
Marc Durdin
f119682cf0
Merge branch 'master' into chore/a18s1-merge-beta-into-master 2024-05-02 14:48:58 +10:00
Eberhard Beilharz
627703734a
fix(linux): Fix icon for .kmp files
It seems some Ubuntu versions ignore the `icon` field and only use
`generic-icon`, so this change adds that field. This will fix displaying
the icon on newer Ubuntu versions. And since we keep the `icon` field
it should still work everywhere else.

Fixes #11144.
2024-04-24 18:00:41 +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
b4755c20ac
feat(linux): Add pyxdg as binary pkg dependency and to setup.py 2024-03-22 18:10:30 +01:00
Eberhard Beilharz
aefcfb1849
fix(linux): Fix cleanup of files 2024-03-22 15:42:27 +01:00