Commit graph

736 commits

Author SHA1 Message Date
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
Weng Xuetian
4517c03f1d
Do not restart Fcitx
1. Fcitx does not need restart to load newly installed keyman keyboard
2. Restart fcitx may cause issue on kwin/weston Wayland where input
   method have to be spawned by compositor process.
2023-12-07 13:41:21 -08:00
Eberhard Beilharz
3cc016fc8a
fix(linux): Fix uninstallation of shared keyboard
This fixes the uninstallation of shared keyboards if the
`additional-keyboards` settings doesn't exist yet.

Closes #9879.
2023-10-27 19:26:35 +02:00
Eberhard Beilharz
09907b66e0
chore(linux): Additionally specify regular schemas path 2023-10-18 18:20:48 +02:00
Eberhard Beilharz
4a3556ca89
chore(linux): Allow to collect coverage on TC 2023-10-18 16:06:28 +02:00
Eberhard Beilharz
f178959c02
Merge pull request #9774 from keymanapp/fix/linux/9773_python3.8
fix(linux): Fix crash initializing Sentry with Python < 3.10
2023-10-17 18:02:39 +02: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
a76945615b
Merge pull request #9735 from keymanapp/feat/linux/8598_arbitrary-lang
feat(linux): Allow loading of keyboards with arbitrary language 🏘️
2023-10-16 19:48:56 +02:00
Eberhard Beilharz
d7a72e6baf
fix(linux): Fix crash initializing Sentry with Python < 3.10
Ubuntu 20.04 comes with Python 3.8 which doesn't have
`platform.freedesktop_os_release()`. This change catches the exception
if this happens, as well as other exceptions we might get so that the
initialization of Sentry will succeed.

Fixes #9773.
2023-10-16 18:44:18 +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
2a7d1758ae
feat(linux): Store user-added keyboards in GSettings 🏘️ 2023-10-12 18:31:41 +02:00
Eberhard Beilharz
4ad730d6f6
chore(linux): Add code coverage report for keyman-config 2023-10-12 10:21:11 +02:00
Eberhard Beilharz
405f2e8243
Merge pull request #9725 from keymanapp/chore/linux/sentrydetails
chore(linux): Improve Sentry reports
2023-10-10 15:06:35 +02:00
Eberhard Beilharz
1dd3eae01a
chore(linux): Add more details to Sentry events
This change adds additional details to Sentry events so that the "All
Events" tab on keyman.sentry.io will show helpful values in the
"device" and "os" columns instead of emptry strings.
2023-10-09 11:44:24 +02:00
Eberhard Beilharz
9650b3f0a2
fix(linux): Fix calculation of user hash
The `hash` method that we previously used calculates the hash based on
the memory location, i.e. with each program run we get a different value
for the same user. This change now uses the md5 algorithm so that the
same user always produces the same hash.
2023-10-09 11:42:19 +02:00
Eberhard Beilharz
2e4dd10522
fix(linux): Explicitly initialize GTK
Usually this is done automatically. However, if e.g. no `DISPLAY` variable
is set it'll fail. When we explicitly initialize GTK it still fails, but
shows a more helpful warning instead of throwing a runtime error.

Fixes #9705.
2023-10-06 16:50:30 +02:00
Darcy Wong
040e41a8f6
Merge pull request #9550 from keymanapp/chore/common/crowdin-mon
chore(common): Add Crowdin strings for Mon
2023-09-28 16:03:34 +07:00
Eberhard Beilharz
b2084930af
fix(linux): Fix detection of unit tests
When running on Ubuntu 20.04 Focal, one of the Python dependencies
loads the `unittest` module so that running `km-config` output the
message that Sentry would be disabled because unit tests are running.

This change now uses the callstack to check if we're running unit
tests.

Fixes #9577.
2023-09-21 12:02:33 +02:00
Eberhard Beilharz
b764a1c965
fix(linux): Correctly open files linked from help page
This works around the issue where browsers installed as snap package
can't access files under `$HOME/.local`. Instead we now only open
external links with the browser. Local non-html files we open with
the default app, and links to local html file we open in webview
(like we did previously with `welcome.htm` files).

Fixes #9600.
2023-09-20 11:49:53 +02:00
Eberhard Beilharz
a03eca3d81
refactor(linux): Rename defines to clarify purpose 🏘️ 2023-09-18 19:00:29 +02:00
Darcy Wong
427459ce29 chore(common): Add crowdin strings for Mon 2023-09-12 13:05:44 +07:00
Eberhard Beilharz
456254a896
chore(linux): Log if user not set 2023-09-11 18:21:36 +02:00
Eberhard Beilharz
ffa3324be2 fix(linux): Prevent exception if neither USER, LOGNAME nor SUDO_USER set
Closes #9542.
2023-09-05 09:17:10 +02:00
Eberhard Beilharz
aaef0f3c7f
chore(linux): Add clean target to rules
This allows to completely cleanup after a package build. Also fixes
`keyman-config/build.sh` to do a better job with clean.

Fixes #9518.
2023-08-31 16:18:18 +02:00