-
Notifications
You must be signed in to change notification settings - Fork 3
Feature/launch at login #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexbartok
wants to merge
12
commits into
validatedev:main
Choose a base branch
from
alexbartok:feature/launch-at-login
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
Add ability to detect and display listening ports for running services using lsof.
Features:
- Detect TCP/UDP listening ports for services and their child processes
- Display ports in service info panel with protocol and port number
- Show port summary in service actions popover (first 3 ports)
- Automatically detect child processes to catch ports from worker processes
Implementation:
- PortDetector actor uses lsof to find listening ports by PID
- Recursively finds all descendant PIDs to include child process ports
- ServicePort model represents detected ports with protocol type
- Ports displayed in both detail panel and popover menu
Technical details:
- Uses `lsof -nP -iTCP -sTCP:LISTEN -a -p {pids}` for detection
- Uses `ps -o pid= -g {pid}` to find child processes
- Port detection is non-blocking and gracefully handles errors
- No thousands separators in port number display
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Add ability to configure custom URLs for each service with auto-detection based on detected ports. Features: - Configure custom URLs per service (e.g., http://localhost:8384 for Syncthing) - Auto-suggest URLs based on detected listening ports - Display links as inline icon buttons in service rows (up to 2 visible) - Full link management UI with add/edit/delete functionality - Persistent storage across app restarts - Service-agnostic design (no hardcoded service-specific URLs) Implementation: - ServiceLinksStore manages links with JSON persistence to Application Support - Links displayed inline in service rows and in popover menu - ServiceLinksManagementView provides full CRUD interface - Smart URL suggestions for common HTTP/HTTPS ports - Opens links in default browser via NSWorkspace Technical details: - Uses @observable pattern for reactive state management - Persists to ~/Library/Application Support/BrewServicesManager/{bundleId}/service-links.json - Inline overlay-based forms (avoids .sheet() issues in menu bar extras) - Supports multiple links per service with optional custom labels - Auto-focuses text fields for better UX 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Improve visual consistency in the popover header section: - Use consistent spacing for all HStack elements in header - Align status and port information properly with action icons - Match line heights between header section and menu items Changes: - Change VStack spacing from tightSpacing to compactSpacing for better vertical rhythm - Add explicit tightSpacing to status and operation HStacks - Ensures network icon and status icon align consistently 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Fix system authentication dialog interaction issue in MenuBarExtra context. Problem: When switching to system domain or performing privileged operations, the osascript authentication dialog appears but cannot receive mouse clicks because the MenuBarExtra interferes with input handling. Solution: Call NSApp.activate(ignoringOtherApps: true) before showing the authentication dialog. This brings the app to the foreground and ensures the system dialog can properly receive user input. Changes: - Import AppKit in PrivilegeEscalator - Add NSApp.activate() call on MainActor before executing osascript - Dialog now properly accepts clicks and keyboard input This complements the earlier fix for SwiftUI dialogs (using inline overlays instead of .sheet()) to fully resolve dialog interaction issues in menu bar extras. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Replaces command-line osascript with NSAppleScript API running on MainActor. This fixes the issue where the system authentication dialog could not be interacted with using the mouse in MenuBarExtra apps. The previous approach of activating the app didn't work because osascript ran as a separate process, causing focus issues. NSAppleScript executes in-process on the main thread, properly associating the auth dialog with the app's event loop. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Adds comprehensive documentation for the new features: - Port detection: automatic discovery of listening ports - Service links: user-configurable URLs for web interfaces - Troubleshooting section for port detection issues - Documentation for the authentication dialog fix 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Removes hardcoded DEVELOPMENT_TEAM settings to allow contributors to use their own Apple Developer accounts. Contributors will need to select their team in Xcode's Signing & Capabilities editor when building. This is standard practice for open source macOS projects. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Adds clear instructions for configuring code signing after removing hardcoded development team IDs. Documents the requirement for an Apple Developer account and provides step-by-step setup instructions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
- Fix data race in ServiceLinksStore save() method - Fix child process detection using pgrep instead of ps -g - Improve URL validation with blacklist approach - Simplify redundant port range logic - Make detectedPorts immutable in BrewServiceInfoEntry - Fix misleading PostgreSQL example in README - Remove thousands separator from port suggestions Addresses feedback from Copilot PR review on: - Data race concerns with Swift concurrency - Incorrect ps command semantics - Security concerns with URL validation - Code quality improvements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
- Remove thousands separators from port numbers in UI - Trigger port detection when actions popover opens - Ensure ports appear immediately without requiring View Info click Port numbers now display without locale formatting (8080 not 8,080) and are detected eagerly when user opens the actions menu. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Adds the ability to automatically start the app when the user logs in to macOS, using the modern SMAppService API from ServiceManagement framework. Changes: - Add LaunchAtLoginError.swift for error handling - Extend AppSettings with launch-at-login state management and system synchronization - Update SettingsView with toggle UI and inline error display - Add entitlements file (without app sandbox to preserve Homebrew access) - Configure CODE_SIGN_ENTITLEMENTS in Xcode project - Update README with new feature documentation The implementation: - Syncs with system state on app launch to handle manual changes - Handles errors gracefully with user-friendly messages - Provides direct link to System Settings when approval is needed - Works without requiring full app sandboxing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Owner
|
You're amazing thank you! I'll check this PR tomorrow |
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.
Sorry, one more while I'm at it ;-)
Add Launch at Login Functionality
Summary
Adds the ability to automatically start BrewServicesManager when the user logs in to macOS. This feature uses the modern
SMAppServiceAPI from the ServiceManagement framework, providing a native and reliable launch-at-login experience.Changes
New Files
LaunchAtLoginError.swift- Error type for handling launch-at-login failures with localized descriptions and recovery suggestionsBrewServicesManager.entitlements- Entitlements file for code signing with documentation explaining why app sandbox is disabled to preserve Homebrew accessModified Files
AppSettings.swift- Added launch-at-login state management with:SMAppServiceSettingsView.swift- Added new "Launch" settings card with:project.pbxproj- ConfiguredCODE_SIGN_ENTITLEMENTSfor both Debug and Release buildsproject.pbxproj- Updated deployment target to 15.0 (from 15.7) and configuredCODE_SIGN_ENTITLEMENTSfor both Debug and Release buildsREADME.md- Updated feature list and settings documentationImplementation Details
Architecture
The implementation follows existing patterns in the codebase:
AppSettings(@observable class) rather than creating a separate managerdidSetobservers for automatic updatesKey Features
Technical Decisions
Why No App Sandbox?
Initially implemented with full app sandboxing (as commonly recommended for ServiceManagement), but this broke Homebrew detection and command execution. Testing revealed that
SMAppServiceworks perfectly without app sandboxing on modern macOS. The entitlements file includes only the minimalcom.apple.application-identifierkey, with XML comments documenting why sandboxing is disabled (to preserve shell access for Homebrew commands, sudo privilege escalation, and lsof port detection).Error State Handling
.notFoundstatus (which occurs when running from Xcode or when not yet registered) is treated as a normal state rather than an error, preventing unnecessary error messages on first launch.Testing
Manual Testing Checklist
Notes