fix(hotkeys): prefer evdev on GNOME X11 and skip redundant IBus engine restore (#963)
Fixes #954. GNOME X11: mutter never delivers physical key events to the XRecord extension pynput relies on, so the listener started cleanly but shortcuts stayed dead. Prefer the evdev backend there (same path as Wayland), falling back to pynput when /dev/input is unusable. Shutdown: `ibus engine <name>` rewrites the whole X server XKB map, and the unconditional restore collapsed GNOME's multi-layout map and broke layout switching. The daemon check now uses _query_active_engine() (no GNOME gsettings fallback) so a cleared engine reads as None; the restore write is skipped when a real engine is live or the target is an xkb:* source GNOME owns, and still runs for real IM engines (#558).
This commit is contained in:
@@ -428,6 +428,7 @@ class TestStopEngineProcess(unittest.TestCase):
|
||||
class TestStopRestoreRetry(unittest.TestCase):
|
||||
"""Coverage for stop() restore retry after teardown."""
|
||||
|
||||
@patch("vocalinux.text_injection.ibus_engine._query_active_engine", return_value=None)
|
||||
@patch("vocalinux.text_injection.ibus_engine.stop_engine_process")
|
||||
@patch("vocalinux.text_injection.ibus_engine.get_current_engine", return_value="xkb:es::spa")
|
||||
@patch("vocalinux.text_injection.ibus_engine.switch_engine", return_value=False)
|
||||
@@ -435,7 +436,7 @@ class TestStopRestoreRetry(unittest.TestCase):
|
||||
@patch("vocalinux.text_injection.ibus_engine.IBUS_AVAILABLE", True)
|
||||
@patch("vocalinux.text_injection.ibus_engine.ensure_ibus_dir")
|
||||
def test_stop_retries_failed_engine_restore(
|
||||
self, mock_ensure_dir, mock_sleep, mock_switch, mock_get_current, mock_stop_proc
|
||||
self, mock_ensure_dir, mock_sleep, mock_switch, mock_get_current, mock_stop_proc, mock_live
|
||||
):
|
||||
"""stop() retries switch_engine after teardown when the first attempts fail."""
|
||||
from vocalinux.text_injection.ibus_engine import IBusTextInjector
|
||||
|
||||
Reference in New Issue
Block a user