Update bluetooth.py: fix import crash; add robust no-BT fallback#1132
Open
pullclone wants to merge 1 commit intoJas-SinghFSU:masterfrom
Open
Update bluetooth.py: fix import crash; add robust no-BT fallback#1132pullclone wants to merge 1 commit intoJas-SinghFSU:masterfrom
pullclone wants to merge 1 commit intoJas-SinghFSU:masterfrom
Conversation
This commit fixes an import-time crash in bluetooth.py and makes the agent robust when DBus/GLib bindings or the BlueZ daemon are missing. - Pass human-readable message as the first arg and DBus error name via name= (e.g., org.bluez.Error.Rejected, org.bluez.Error.Canceled). - Switch Agent capability to KeyboardDisplay so both PIN and passkey flows are supported. Robust behavior when Bluetooth is unavailable - Introduce HYPERPANEL_BT_KEEP_ALIVE env flag (default: off). - When deps or BlueZ are missing, either exit(0) or idle (GLib loop/sleep) based on the flag. - Add helpers: - idle_or_exit to centralize graceful shutdown/idle behavior. - is_bluez_running to check org.bluez on the system bus before attempting registration. - Improve user interaction and notifications: - request_input_sync uses zenity when available, otherwise falls back to TTY input; handles cancellations cleanly. - send_notification_with_actions returns a Callable[[], None] disconnect and safely unregisters signal handlers; logs and no-ops if notifications aren’t available. Other additions - More informative logging around agent registration and user prompts. - Defensive handling when removing signal receivers. - Typing polish for send_notification_with_actions. Behavioral notes - No behavioral change when BlueZ and deps are present: the agent registers and runs the GLib main loop as before. - When BlueZ or deps are missing, hyprpanel no longer aborts due to a parse error; the script exits 0 by default unless keep-alive is requested. Testing tips - Catch syntax errors early: python3 -m compileall -q /usr/share/hyprpanel/scripts/bluetooth.py - Simulate missing BlueZ: systemctl stop bluetooth; run the script and verify exit code 0 (or idle when HYPERPANEL_BT_KEEP_ALIVE=1). - Start hyprpanel and confirm it no longer aborts on bluetooth.py
lika85456
added a commit
to lika85456/HyprPanel
that referenced
this pull request
Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit fixes an import-time crash in bluetooth.py and makes the agent robust when DBus/GLib bindings or the BlueZ daemon are missing.
Robust behavior when Bluetooth is unavailable
Other additions
Behavioral notes
Testing tips