feat(linux): Try only 5 instead of 10000 times to connect to ibus

Part of #4910.
This commit is contained in:
Eberhard Beilharz 2021-06-02 15:16:22 +02:00
parent 529ab546cb
commit 5a3a7910ab
No known key found for this signature in database
GPG key ID: 64A39A9E98B53105

View file

@ -1,5 +1,6 @@
#!/usr/bin/python3
import time
import gi
import logging
import subprocess
@ -10,11 +11,12 @@ from gi.repository import IBus, Gio
def get_ibus_bus():
try:
for i in range(10000):
for i in range(5):
bus = IBus.Bus()
if bus.is_connected() and bus.is_global_engine_enabled():
return bus
bus.destroy()
time.sleep(1)
except Exception as e:
logging.warning("Failed get bus")
logging.warning(e)