feat(linux): implement UI part of SimulateAltGr option

This commit is contained in:
Eberhard Beilharz 2024-06-18 20:15:56 +02:00
parent d93fb6aa0b
commit 3c800ed65a
No known key found for this signature in database
GPG key ID: E9140597606020D3
3 changed files with 17 additions and 4 deletions

View file

@ -38,8 +38,7 @@ pip3 install sentry-sdk
Copy and compile the GSettings schema:
```bash
cd keyman_config
sudo cp com.keyman.gschema.xml /usr/share/glib-2.0/schemas
sudo cp linux/keyman-config/resources/com.keyman.gschema.xml /usr/share/glib-2.0/schemas
sudo glib-compile-schemas /usr/share/glib-2.0/schemas
```

View file

@ -7,6 +7,7 @@ gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from keyman_config import _
from keyman_config.keyman_option import KeymanOption
class OptionsWidget(Gtk.Box):
@ -17,11 +18,11 @@ class OptionsWidget(Gtk.Box):
label.set_halign(Gtk.Align.START)
self.pack_start(label, False, False, 10)
(enabled, reason) = sentry.is_sentry_enabled()
(sentry_enabled, reason) = sentry.is_sentry_enabled()
disabledByVariable = sentry.is_sentry_disabled_by_variable()
self.errorReportingButton = Gtk.CheckButton(_("Automatically report errors to keyman.com"))
self.errorReportingButton.set_active(enabled)
self.errorReportingButton.set_active(sentry_enabled)
self.errorReportingButton.set_sensitive(not disabledByVariable)
sentry.bind_checkbutton(self.errorReportingButton)
self.pack_start(self.errorReportingButton, False, False, 0)
@ -32,3 +33,10 @@ class OptionsWidget(Gtk.Box):
label.set_padding(25, 0)
label.set_sensitive(False)
self.pack_start(label, False, False, 0)
self.simulate_altgr_option = KeymanOption('simulate-altgr')
self.simulate_altgr_enabled = self.simulate_altgr_option.get()
self.simulateAltGrButton = Gtk.CheckButton(_("Simulate AltGr with Ctrl + Alt"))
self.simulateAltGrButton.set_active(sentry_enabled)
self.simulate_altgr_option.bind_checkbutton(self.simulateAltGrButton)
self.pack_start(self.simulateAltGrButton, False, False, 0)

View file

@ -7,6 +7,12 @@
<summary>Automatic error reporting</summary>
<description>true to enable automatic reporting of errors to Sentry</description>
</key>
<key name="simulate-altgr" type="b">
<default>false</default>
<summary>Simulate AltGr with Ctrl+Alt</summary>
<description>true will allow Ctrl+Alt to be used for AltGr. If false
Ctrl+Alt will not be used to simulate the AltGr key.</description>
</key>
</schema>
<schema id="com.keyman.options.child">