Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions blueman/main/applet/BluezAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def __init__(self) -> None:
self._db: Optional[ElementTree.ElementTree] = None
self._devhandlerids: Dict[str, int] = {}
self._notification: Optional[Union[_NotificationBubble, _NotificationDialog]] = None
self._passkey_notification: Optional[Union[_NotificationBubble, _NotificationDialog]] = None
self._service_notifications: List[Union[_NotificationBubble, _NotificationDialog]] = []

def register_agent(self) -> None:
Expand Down Expand Up @@ -158,6 +159,9 @@ def _close(self) -> None:
if self._notification is not None:
self._notification.close()
self._notification = None
if self._passkey_notification is not None:
self._passkey_notification.close()
self._passkey_notification = None

def _on_request_pin_code(self, object_path: str, ok: Callable[[str], None],
err: Callable[[Union[BluezErrorCanceled, BluezErrorRejected]], None]) -> None:
Expand All @@ -184,9 +188,11 @@ def _on_display_passkey(self, object_path: str, passkey: int, entered: int) -> N
key = f"{passkey:06}"
notify_message = _("Pairing passkey for") + f" {self.get_device_string(object_path)}: " \
f"{key[:entered]}<b>{key[entered]}</b>{key[entered + 1:]}"
self._close()
self._notification = Notification("Bluetooth", notify_message, 0, icon_name="blueman")
self._notification.show()
if self._passkey_notification is None:
self._passkey_notification = Notification("Bluetooth", notify_message, 0, icon_name="blueman")
self._passkey_notification.show()
else:
self._passkey_notification.set_message(notify_message)

def _on_display_pin_code(self, object_path: str, pin_code: str) -> None:
logging.info(f'DisplayPinCode ({object_path}, {pin_code})')
Expand Down