🚧 Port Kill A lightweight macOS status bar app that monitors and manages development processes running on ports 2000-6000. The app provides real-time process detection and allows you to kill individual processes or all processes at once. Features Real-time Monitoring : Scans ports 2000-6000 every 5 seconds using lsof commands : Scans ports 2000-6000 every 5 seconds using commands Visual Status Bar Icon : Shows process count with color-coded center (green=0, red=1-9, orange=10+) : Shows process count with color-coded center (green=0, red=1-9, orange=10+) Dynamic Context Menu : Updates every 3 seconds with current processes and kill options : Updates every 3 seconds with current processes and kill options One-Click Process Killing : Click any menu item to kill all detected processes : Click any menu item to kill all detected processes Safe Process Termination : Uses SIGTERM β†’ SIGKILL termination strategy : Uses SIGTERM β†’ SIGKILL termination strategy Stable Architecture : Built with winit event loop for macOS compatibility : Built with winit event loop for macOS compatibility Graceful Error Handling : Handles permission errors and process failures : Handles permission errors and process failures No Windows: Pure status bar application with no main window Status Bar Icon The status bar icon provides instant visual feedback: White background with green center : 0 processes (safe, no development servers) : 0 processes (safe, no development servers) White background with red center : 1-9 processes (some development servers) : 1-9 processes (some development servers) White background with orange center: 10+ processes (many development servers) Hover over the icon to see the exact process count in the tooltip. Menu Options Kill All Processes : Terminates all detected development processes : Terminates all detected development processes Individual Process Entries : Format: "Kill: Port 3001: node (PID 1234)" : Format: "Kill: Port 3001: node (PID 1234)" Quit: Exits the application Note: Currently, clicking any menu item will kill all processes (for testing purposes). Requirements macOS 10.15 or later Rust 1.70 or later lsof command (included with macOS) Installation Clone the repository: git clone < repository-url > cd port-kill Build the application: cargo build --release Run the application (easy way): ./run.sh Run manually (alternative): cargo run --release Usage Start the Application: Run ./run.sh to start the application Monitor Status: Check the status bar for the process count indicator Access Menu: Click on the status bar icon to open the context menu Kill Processes: Click "Kill All Processes" to terminate all development processes Click individual process entries to kill specific processes Quit: Click "Quit" to exit the application Technical Details Architecture Main Thread : Handles UI events and menu interactions with winit event loop : Handles UI events and menu interactions with winit event loop Process Monitor : Scans for processes every 5 seconds using lsof : Scans for processes every 5 seconds using Menu Updates : Updates context menu every 3 seconds when processes change : Updates context menu every 3 seconds when processes change Process Killing: Runs in background threads to maintain UI responsiveness Process Detection The application uses the following command to detect processes: lsof -ti :PORT -sTCP:LISTEN Process Termination SIGTERM: First attempts graceful termination SIGKILL: If process doesn't terminate within 500ms, forces termination Port Range Monitors ports 2000-6000 (broad range covering common development server ports) Icon Design Clean white background for subtle appearance Color-coded center area for quick status assessment No borders for modern, minimal aesthetic Dependencies tray-icon : macOS status bar integration : macOS status bar integration winit : Event loop management : Event loop management nix : Signal handling for process termination : Signal handling for process termination crossbeam-channel : Thread communication : Thread communication tokio : Async runtime : Async runtime anyhow : Error handling : Error handling serde : Data serialization Development Project Structure src/ β”œβ”€β”€ main.rs # Application entry point β”œβ”€β”€ lib.rs # Module declarations β”œβ”€β”€ app.rs # Main application logic β”œβ”€β”€ process_monitor.rs # Process detection and termination β”œβ”€β”€ tray_menu.rs # Status bar menu management └── types.rs # Data structures Building for Development cargo build Running with Logging RUST_LOG=info cargo run Troubleshooting Permission Issues If you encounter permission errors when trying to kill processes: Ensure the application has the necessary permissions Some system processes may be protected Check if the process is owned by another user Process Not Detected If a process is not being detected: Verify the process is listening on a port in the 2000-6000 range Check if the process is using TCP (not UDP) Ensure the process is in LISTEN state Application Not Starting If the application fails to start: Check if another instance is already running Verify all dependencies are installed Check system logs for error messages License This project is licensed under the FSL-1.1-MIT License. See the LICENSE file for details. Contributing Fork the repository Create a feature branch Make your changes Add tests if applicable Submit a pull request Security Notes Process Access The application requires access to process information and termination capabilities Uses lsof command to detect processes listening on ports 2000-6000 command to detect processes listening on ports 2000-6000 Requires appropriate permissions to send termination signals to processes Process Termination Uses standard Unix signals: SIGTERM (graceful) β†’ SIGKILL (force) after 500ms Only terminates processes that are listening on the monitored port range Cannot terminate system processes or processes owned by other users without proper permissions Data Privacy No data collection : The application does not collect, store, or transmit any data : The application does not collect, store, or transmit any data No network communication : All operations are local to your machine : All operations are local to your machine No logging of sensitive information: Only process counts and basic metadata are logged Permissions Required Process monitoring : Read access to process information via lsof : Read access to process information via Process termination : Ability to send signals to processes you own : Ability to send signals to processes you own Status bar access: Standard macOS status bar permissions Limitations