From 78bc260e7ae6ab76c00d6de08512d1e06fc05422 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Thu, 19 Jun 2025 12:59:42 +0545 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(bluetooth):=20add=20support=20?= =?UTF-8?q?for=20"blue"=20trigger=20and=20set=20bluetooth=20client=20creat?= =?UTF-8?q?ion=20timeout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/launcher/plugins/bluetooth.py | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/modules/launcher/plugins/bluetooth.py b/modules/launcher/plugins/bluetooth.py index c556c38..2c517f7 100644 --- a/modules/launcher/plugins/bluetooth.py +++ b/modules/launcher/plugins/bluetooth.py @@ -29,7 +29,7 @@ class BluetoothPlugin(PluginBase): def initialize(self): """Initialize the bluetooth plugin.""" - self.set_triggers(["bt", "bt "]) + self.set_triggers(["bluetooth", "bt", "blue"]) def cleanup(self): """Cleanup the bluetooth plugin.""" @@ -49,20 +49,10 @@ class BluetoothPlugin(PluginBase): def _init_bluetooth_client(self): """Initialize bluetooth client with proper error handling.""" try: - # Check if bluetooth is available by trying to import and create client - import signal - import gi - - # Check if GnomeBluetooth is available - try: - gi.require_version("GnomeBluetooth", "3.0") - from gi.repository import GnomeBluetooth - except Exception: - print("Warning: GnomeBluetooth library not available") - return - # Set up timeout for bluetooth client creation - def timeout_handler(signum, frame): + import signal + + def timeout_handler(_signum, _frame): raise TimeoutError("Bluetooth client initialization timeout") old_handler = signal.signal(signal.SIGALRM, timeout_handler) @@ -89,11 +79,11 @@ class BluetoothPlugin(PluginBase): print(f"Warning: Bluetooth initialization failed: {e}") self.bluetooth_client = None - def _on_bluetooth_changed(self, *args): + def _on_bluetooth_changed(self, *_args): """Called when bluetooth state changes.""" pass - def _on_device_changed(self, *args): + def _on_device_changed(self, *_args): """Called when devices are added or removed.""" pass