From 50733fe4ebac28136144d5b85721ee5fd0b7850a Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 14 Feb 2026 12:32:54 +0200 Subject: Add macOS support with automatic window activation This commit adds full macOS support for loadbars, allowing it to run natively on macOS for both localhost monitoring and remote Linux hosts. Key changes: - Embed both Linux and Darwin monitoring scripts in the binary - Auto-detect localhost OS and use appropriate script - Darwin script uses native macOS tools (sysctl, vm_stat, netstat, iostat) - Remote hosts always use Linux script (assumes /proc filesystem) - Automatic window activation on macOS using build tags - No external helper scripts needed The binary now works seamlessly on macOS: - localhost monitoring uses macOS-specific commands - Remote Linux hosts work via SSH with Linux script - SDL window automatically comes to foreground on macOS - Cross-platform build with single binary for all scenarios Technical implementation: - internal/collector/script.go: Embeds both scripts - internal/collector/loadbars-remote-darwin.sh: macOS monitoring - internal/collector/loadbars-remote.sh: Linux monitoring (copied from scripts/) - internal/display/activate_darwin.go: macOS window activation - internal/display/activate.go: No-op for other platforms - Updated README.md with macOS installation instructions - Added MACOS.md with detailed macOS documentation --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 5f3f938..d06873a 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,11 @@ loadbars [LIST OF HOSTNAMES] [OPTIONS] ### Tested platforms -This version of loadbars has been tested on Fedora Linux 43 and should work on -most modern Linux distributions (RHEL, CentOS, Ubuntu, Debian, etc.). +This version of loadbars has been tested on: +- Fedora Linux 43 and most modern Linux distributions (RHEL, CentOS, Ubuntu, Debian, etc.) +- macOS (Darwin) - localhost monitoring uses native macOS tools (sysctl, vm_stat, netstat, iostat) + +**Note:** Remote hosts are assumed to be Linux (using /proc filesystem). When running on macOS, localhost monitoring uses macOS-specific commands, while remote hosts use the Linux script. ### I like flying elephants @@ -102,6 +105,14 @@ On Ubuntu/Debian: sudo apt install libsdl2-dev ``` +On macOS: + +```bash +brew install sdl2 +``` + +**macOS Note:** The window will automatically come to the foreground when launched. No additional scripts needed. + ### Running from Source To run loadbars directly from the source directory: -- cgit v1.2.3