Commit graph

762 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
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
Eberhard Beilharz
6b292ae7b7
fix(linux): Don't expect DBUS_SESSION_BUS_PID to be set
`DBUS_SESSION_BUS_PID` gets only set when launching dbus in the process,
but not when it's already running.
2024-03-22 15:41:50 +01: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
27b09fc728
chore(linux): Merge branch 'beta' into feat/linux/9363DBusEnv 2024-03-20 15:48:43 +01:00
Eberhard Beilharz
d7d5c8045b
Merge pull request #10860 from keymanapp/fix/linux/10850_deprecation
fix(linux): Replace deprecated `pkg_resources` module with `packaging.version`
2024-03-20 15:47:34 +01:00
Eberhard Beilharz
2af4a04881
fix(linux): Start ibus if not running
Also need to start as daemon so that it works when run as a different user.
2024-03-20 12:17:57 +01:00
Eberhard Beilharz
b9d116adad
fix(linux): Replace deprecated pkg_resources module in remaining places
Previous commit missed a few places where `pkg_resources` module was
used.
2024-03-20 11:44:00 +01:00
Eberhard Beilharz
01b8016b92
chore(linux): Merge remote-tracking branch 'origin/beta' into feat/linux/9363DBusEnv 2024-03-20 11:24:35 +01:00
Eberhard Beilharz
37024fa832
chore(linux): Change order of initialization
If we want to log messages we need to start DBus after we initialized
logging.
2024-03-20 11:18:28 +01:00
Eberhard Beilharz
42fd48c808
fix(linux): Improve error values 2024-02-29 18:54:25 +01:00
Eberhard Beilharz
f899627129
fix(linux): Add packaging Python dependency
It isn't enough to have the package as build dependency, we also have to
list is in the binary package or in the `install_requires` list in
`setup.py`. This change also adds other missing python modules to
`install_requires` so that things work correctly if building/installing
from source.
2024-02-29 18:50:30 +01:00
Eberhard Beilharz
196796b67a
feat(linux): Start dbus if not running
This change checks the DBus environment variables when initializing the
`keyman_config` module and starts DBus if the variables are not set.
This particularly happens when trying to install or uninstall a keyboard
for a different user, which will now be possible with this change.

Fixes #9363.
2024-02-27 19:13:02 +01:00
Eberhard Beilharz
b9ef6d7bb5
fix(linux): Replace deprecated pkg_resources module with packaging.version
Fixes #10850.
2024-02-27 17:41:07 +01:00
Eberhard Beilharz
8ff35c8657
fix(linux): fix regex to detect running ibus-daemon
On Ubuntu 20.04 Focal ibus gets started by a shell command so that we
end up with two processes mentioning `ibus-daemon`. This change limits
the search to processes that specify with full path to `ibus-daemon` or
without path, but `ibus-daemon` has to be the command, not a parameter.
2024-02-26 18:40:23 +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
5e661c4196
fix(linux): When starting km-package-install verify that ibus-daemon is running 2024-02-26 16:34:45 +01:00
Eberhard Beilharz
131d4989ec
fix(linux): When starting km-config verify that ibus-daemon is running 2024-02-26 16:34:44 +01:00
Eberhard Beilharz
8c8d339bb1
refactor(linux): Change verify_ibus_daemon to return a state 2024-02-26 16:34:44 +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
6722faab4d
fix(linux): Use raw string for regex
This change fixes a syntax warning with Python 3.12. See
https://stackoverflow.com/a/50504635/487503 and
https://docs.python.org/3/whatsnew/3.12.html#other-language-changes.
2024-02-06 17:01:59 +01:00
Eberhard Beilharz
29c71253db
chore(core): Update debian package to use webkit2 4.1
Ubuntu 20.04 Focal doesn't have webkit2 4.1. The API is the same as
with 4.0, so we use that if we can't find 4.1.
2024-01-24 16:47:22 +01:00
Jeremy Bícha
7ea8d9648b chore(linux): Build with webkitgtk 4.1 instead of 4.0 2024-01-23 14:40:57 -05:00
Eberhard Beilharz
5069d8c67b
chore(linux): Small refactoring to make it easier to read 2023-12-08 18:50:38 +01:00