From d7ff7447327ec886280310e9b1f4ee78d9910140 Mon Sep 17 00:00:00 2001 From: Sander Sweers Date: Sun, 17 May 2026 20:31:34 +0200 Subject: [PATCH 1/3] BluezAgent: Also check for Bonded when removing My legacy pairing keyboards just Bonds so we never see a Paired property. --- blueman/main/applet/BluezAgent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blueman/main/applet/BluezAgent.py b/blueman/main/applet/BluezAgent.py index 121b59a50..c4542d592 100644 --- a/blueman/main/applet/BluezAgent.py +++ b/blueman/main/applet/BluezAgent.py @@ -155,7 +155,7 @@ def passkey_dialog_cb(dialog: Gtk.Dialog, response_id: int) -> None: # Workaround BlueZ not calling the Cancel method, see #164 def _on_device_property_changed(self, device: Device, key: str, value: Any, path: str) -> None: - if (key == "Paired" and value) or (key == "Connected" and not value): + if (key in ("Paired", "Bonded") and value) or (key == "Connected" and not value): handlerid = self._devhandlerids.pop(path) device.disconnect_signal(handlerid) self._on_cancel() From ba674b784f55814a65605f80facfcde229055271 Mon Sep 17 00:00:00 2001 From: Sander Sweers Date: Sun, 17 May 2026 20:35:07 +0200 Subject: [PATCH 2/3] BluezAgent: Don't connect a signal every time in _on_display_passkey We end up connecting 6 times, one for each digit which is a bit much. --- blueman/main/applet/BluezAgent.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/blueman/main/applet/BluezAgent.py b/blueman/main/applet/BluezAgent.py index c4542d592..b0dd04080 100644 --- a/blueman/main/applet/BluezAgent.py +++ b/blueman/main/applet/BluezAgent.py @@ -195,8 +195,9 @@ def _on_request_passkey(self, object_path: ObjectPath, ok: Callable[[int], None] def _on_display_passkey(self, object_path: ObjectPath, passkey: int, entered: int) -> None: logging.info(f"DisplayPasskey ({object_path}, {passkey:d} {entered:d})") - dev = Device(obj_path=object_path) - self._devhandlerids[object_path] = dev.connect_signal("property-changed", self._on_device_property_changed) + if object_path not in self._devhandlerids: + dev = Device(obj_path=object_path) + self._devhandlerids[object_path] = dev.connect_signal("property-changed", self._on_device_property_changed) key = f"{passkey:06}" notify_message = _("Pairing passkey for") + f" {self.get_device_string(object_path)}: " \ From 447102b7ac7621c76db33ec705c6077cfba89d80 Mon Sep 17 00:00:00 2001 From: Sander Sweers Date: Sun, 17 May 2026 20:40:59 +0200 Subject: [PATCH 3/3] BluezAgent: Do not recreate notification in _on_display_passkey As pointed out by @coyotebush we can update the message instead of recreating the whole notification. Co-authored-by: Corey Ford --- blueman/main/applet/BluezAgent.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/blueman/main/applet/BluezAgent.py b/blueman/main/applet/BluezAgent.py index b0dd04080..f01cc0497 100644 --- a/blueman/main/applet/BluezAgent.py +++ b/blueman/main/applet/BluezAgent.py @@ -202,9 +202,11 @@ def _on_display_passkey(self, object_path: ObjectPath, passkey: int, entered: in key = f"{passkey:06}" notify_message = _("Pairing passkey for") + f" {self.get_device_string(object_path)}: " \ f"{key[:entered]}{key[entered]}{key[entered + 1:]}" - self._close() - self._notification = Notification("Bluetooth", notify_message, 0, icon_name="blueman") - self._notification.show() + if self._notification is None: + self._notification = Notification("Bluetooth", notify_message, 0, icon_name="blueman") + self._notification.show() + else: + self._notification.set_message(notify_message) def _on_display_pin_code(self, object_path: ObjectPath, pin_code: str) -> None: logging.info(f'DisplayPinCode ({object_path}, {pin_code})')