CLI for SidePulse
Python
Fix status-bar startup failing on missing ScriptingBridge
Peter Kuhar3b832932c022
diff --git a/pyproject.toml b/pyproject.tomlindex 333470a..c6a5af3 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -31,6 +31,7 @@ dependencies = ["pyobjc-framework-Cocoa>=10; sys_platform == 'darwin'","pyobjc-framework-Quartz>=10; sys_platform == 'darwin'","pyobjc-framework-WebKit>=10; sys_platform == 'darwin'",+ "pyobjc-framework-ScriptingBridge>=10; sys_platform == 'darwin'",][project.urls]diff --git a/src/sidepulse/status_bar.py b/src/sidepulse/status_bar.pyindex 25fc54d..10e6a9d 100644--- a/src/sidepulse/status_bar.py+++ b/src/sidepulse/status_bar.py@@ -49,13 +49,17 @@ try:NSVariableStatusItemLength,)from Foundation import NSObject, NSString, NSTimer, NSURL- from ScriptingBridge import SBApplicationexcept ImportError as exc: # pragma: no cover - only exercised on non-macOS setups.raise SystemExit(- "The status-bar app requires PyObjC/AppKit:\n"+ f"The status-bar app requires PyObjC/AppKit ({exc}):\n"" python3 -m pip install pyobjc-framework-Cocoa") from exc+try:+ from ScriptingBridge import SBApplication+except ImportError: # pragma: no cover - only the Ghostty integration needs this.+ SBApplication = None+from .battery import (BatteryLedController,BatterySnapshot,@@ -3811,6 +3815,8 @@ def open_ghostty_command_with_scripting_bridge(def ghostty_application():+ if SBApplication is None:+ return Noneapp_path = installed_terminal_app_path(TERMINAL_APP_GHOSTTY)if app_path is not None:try: