Commit graph

336 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
ea249da3b3
refactor(linux): Fix warning
Follow-up of #4999 (which mentions different warnings). This
change fixes other warnings that we were still getting.
2023-08-28 20:11:41 +02:00
Eberhard Beilharz
8f39a04375
Merge pull request #9027 from keymanapp/fix/linux/8620_keyboards-with-mul-tag
fix(linux): Fix installation of keyboards with lang tag `mul`
2023-07-21 06:34:58 +02:00
Eberhard Beilharz
f9896756f6
Merge pull request #9310 from keymanapp/fix/linux/logging
fix(linux): Fix logging
2023-07-20 22:48:52 +02:00
Eberhard Beilharz
2f25d198f4
fix(linux): Output not connected ibus as info instead of warning
There is nothing the user can do, and it's usually irrelevant
(except when troubleshooting).
2023-07-20 11:11:43 +02:00
Eberhard Beilharz
8a34a5d6ce
refactor(linux): Some refactorings 2023-07-20 11:09:55 +02:00
Eberhard Beilharz
33603c0f71
refactor(linux): Use better way to get username
`getpass.getuser()` tries several different ways to get the username
and is the recommended way of getting the username.
2023-07-20 11:04:04 +02:00
Eberhard Beilharz
8058d50999
fix(linux): Also output username 2023-07-20 10:48:50 +02:00
Eberhard Beilharz
b814bdd9fa
fix(linux): Reword error if uninstalling non-existent keyboard
This change reworks the output we show if the user tries to
uninstall a non-existing keyboard. This could be trying to uninstall
a shared keyboard when a user keyboard exists and vice versa. This
change rewords the message to include the area (shared/user), so
hopefully this makes it a bit clearer. We also now output this as a
warning instead of an error.

Completely suppressing the message as suggested in #9213 doesn't seem
to be the right way as that would lead to the user blaming uninstall
to not work when the real reason are wrong parameters.

Closes #9213.
2023-07-20 10:11:14 +02:00
Eberhard Beilharz
12165d73bc
fix(linux): Fix logging
We can't initialize Sentry during module initialization because our
`initialize_sentry` logs some status info. Setting the logging level
later on is then a no-op, breaking verbose and very-verbose logging.

This change fixes this by putting Sentry initialization into a
separate method that gets called after we set the log level.

Also refactor some common code into methods that appear in all our
executables.
2023-07-19 19:47:28 +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
8624ebcfb0
Merge pull request #9245 from keymanapp/refactor/linux/refactor
refactor(linux): Refactor image loading
2023-07-13 12:32:07 +02:00
Eberhard Beilharz
3cc9f09d82
fix(linux): Replace deprecated Image.ANTIALIAS
Fixes #9244.
2023-07-11 12:14:26 +02:00
Eberhard Beilharz
eedf7545c8
refactor(linux): Refactor some code 2023-07-11 12:13:45 +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
75d507ca83
Merge pull request #9017 from keymanapp/feat/linux/8619_multiple-languages
feat(linux): Allow to install keyboard for multiple languages
2023-07-06 16:37:28 +02:00
Eberhard Beilharz
6b4b4fda61
Merge pull request #9165 from keymanapp/fix/linux/4769_tags
fix(linux): Remove tags from package description
2023-07-05 16:26:29 +02:00
Eberhard Beilharz
d60f30e7d9
Merge pull request #9166 from keymanapp/fix/linux/9005_AboutPage
fix(linux): Add scrollbar to About dialog
2023-07-05 16:15:33 +02:00
Eberhard Beilharz
f7a593deac
Merge pull request #9167 from keymanapp/fix/linux/vertical_align
fix(linux): Fix vertical alignment of labels in About dialog
2023-07-05 14:53:49 +02:00
Eberhard Beilharz
55fbd1a814
Merge pull request #9168 from keymanapp/refactor/linux/extractions
refactor(linux): Extract methods
2023-07-05 14:53:33 +02:00
Eberhard Beilharz
c6419a9e4c
chore(linux): Add clarifying comment 2023-07-05 11:57:23 +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
1b63cf59b4
chore(linux): Address code review comments 2023-07-05 11:56:55 +02:00
Eberhard Beilharz
66461b7677
feat(linux): Remove message box if same kbd version already installed
We no longer ask the user if he tries to install a keyboard that is
already installed with the same version. The only time we ask is for
downgrades.

A similar change is implemented in `km-package-install` where we
changed the logic to match `install_window.py`. We now silently
install the new version unless it's a downgrade in which case we
output a error message and exit. This change also introduces the
`--force` parameter which allows to install the downgrade. For
upgrades or re-installing the same version it will cause an
uninstall of the current version first.
2023-07-05 11:56:54 +02:00
Eberhard Beilharz
4775c522bb
refactor(linux): Allow to install keyboard for multiple languages
This change makes it possible to install the same keyboard again
for a different language. It won't be visible in the GUI if the
keyboard is installed for more than language, but it will show up
for the installed languages in the keyboard dropdown.

Closes #8619.
2023-07-05 11:56:53 +02:00
Eberhard Beilharz
9b7070b8a6
fix(linux): Remove tags from package description
This is a temporary workaround - see discussion on #8057. While
this is not the perfect solution it should improve things in most
cases.

Fixes #4769.
2023-07-05 11:43:32 +02:00
Eberhard Beilharz
76f0979f3c
fix(linux): Add scrollbar to About dialog
Fixes #9005.
2023-07-05 11:42:51 +02:00
Eberhard Beilharz
d7d5d3220e
fix(linux): Fix vertical alignment of labels in About dialog 2023-07-05 11:41:16 +02:00
Eberhard Beilharz
595b19b9a0
refactor(linux): Extract methods 2023-07-05 11:40:42 +02:00
Eberhard Beilharz
ad1919da29
refactor(linux): Revert type hints
Turns out `list[str] | None` doesn't work with Python < 3.9 which
comes with Ubuntu 20.04 Focal, so we revert that change.
2023-07-05 11:39:33 +02:00
Eberhard Beilharz
481cb4a281
refactor(linux): Code refactoring 2023-07-05 11:39:33 +02:00
Eberhard Beilharz
be5c307fc0
refactor(linux): Rename OptionsView to KeyboardOptionsView 2023-06-13 20:05:49 +02:00
Eberhard Beilharz
ead69e7ee4
refactor(linux): Extract widgets to separate classes and files 2023-06-13 20:05:48 +02:00
Eberhard Beilharz
e95948c2da
refactor(linux): Extract methods 2023-06-13 19:42:14 +02:00
Eberhard Beilharz
d4c27a4d44
chore(linux): Properly compare version numbers
We changed the comparison of version numbers a while ago, but this
one slipped through. Using string comparison for version numbers
is a bad idea... This addresses code review comments.
2023-06-12 19:43:38 +02:00