From f7eb6878bd7a2569286b2b1ccf67cb1dd8ed5d5a Mon Sep 17 00:00:00 2001 From: Sander Sweers Date: Sun, 10 Sep 2023 17:31:08 +0200 Subject: [PATCH] Tray: Let dbus call end and reply to caller Depending on timing we may never send a reply to the caller if we restart immediately. --- blueman/main/Tray.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/blueman/main/Tray.py b/blueman/main/Tray.py index 90684c68f..43ba467d7 100644 --- a/blueman/main/Tray.py +++ b/blueman/main/Tray.py @@ -24,8 +24,9 @@ def do_quit(_: object) -> bool: def do_activate(self) -> None: if self._active: + GLib.timeout_add_seconds(1, lambda: os.execv(sys.argv[0], sys.argv)) logging.info("Already running, restarting instance") - os.execv(sys.argv[0], sys.argv) + return Gio.bus_watch_name(Gio.BusType.SESSION, 'org.blueman.Applet', Gio.BusNameWatcherFlags.NONE, self._on_name_appeared, self._on_name_vanished)