From 285a8463e79315c4215cbdec0312359fbd2bd277 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Thu, 16 Oct 2025 16:58:18 +0200 Subject: [PATCH] =?UTF-8?q?fix(linux):=20use=20`ibus`=20command=20to=20res?= =?UTF-8?q?tart=20ibus=20=F0=9F=8D=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using Kubuntu exiting ibus sometimes used to hang (#10178). This was because ibus' `bus.exit()` doesn't shutdown properly (see https://github.com/ibus/ibus/issues/2816#issuecomment-3410473708). The recommended way is to use the `ibus exit` command. Since we no longer use the API we can directly use the `ibus restart` command, which this PR implements. Fixes: #10178 Cherry-pick-of: #14971 --- linux/keyman-config/keyman_config/ibus_util.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/linux/keyman-config/keyman_config/ibus_util.py b/linux/keyman-config/keyman_config/ibus_util.py index fba1ec5d3f..ec0e410d5f 100644 --- a/linux/keyman-config/keyman_config/ibus_util.py +++ b/linux/keyman-config/keyman_config/ibus_util.py @@ -187,20 +187,8 @@ def restart_ibus(bus=None): logging.info('restarting IBus by subprocess for user %s', realuser) subprocess.run(['sudo', '-u', realuser, 'ibus', 'restart'], check=False) else: - logging.info('restarting IBus through API') - try: - if not bus: - bus = get_ibus_bus() - if bus: - logging.info("restarting IBus") - # we no longer try to restart since we sometimes ended up with more than one - # ibus-daemon process (#6237). Instead we only exit ibus here, and start - # ibus again below. - bus.exit(False) - bus.destroy() - except Exception as e: - logging.warning("Failed to restart IBus") - logging.warning(e) + logging.info('restarting IBus by subprocess') + subprocess.run(['ibus', 'restart'], check=False) # give ibus a chance to shutdown (#6237) time.sleep(1) # 1s verify_ibus_daemon(True)