Add macOS support with native Cocoa overlay window#23
Draft
m31-galaxy wants to merge 1 commit into
Draft
Conversation
Introduce a platform-agnostic windowing/input/GL-surface interface so the gesture engine no longer depends on the Wayland backend directly, and add a macOS (Cocoa) implementation alongside it. - internal/platform: Window interface with per-OS NewWindow (build-tagged window_linux.go / window_darwin.go); the Wayland backend is gated behind //go:build linux. - pkg/cocoa: a transparent, borderless, fullscreen NSWindow overlay with an OpenGL 4.1 core context. Renders in logical points (not backing pixels) so gl_FragCoord, the resolution uniform, and cursor coordinates line up with the Wayland backend on Retina displays. Handles mouse move/drag/click and the Escape key, and hides the system cursor while active. - Core modules (draw/execute/update/main) consume platform.Window instead of wayland.WaylandWindow. On macOS, launching draws a gesture once and exits, matching the Linux per-launch model. - flake.nix builds on x86_64/aarch64 for both Linux and Darwin (Cocoa/OpenGL come from the macOS stdenv; Wayland/X11 deps are Linux-only); CI builds on Ubuntu and macOS. - macos/ carries the app icon assets for future bundling. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LjKPHZaHPxMhLXGe55hMeW
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.
Summary
This PR adds full macOS support to Hexecute by implementing a native Cocoa backend alongside the existing Wayland/Linux implementation. The app now runs on both Linux and macOS with platform-specific windowing and input handling.
Key Changes
New Cocoa Backend (
pkg/cocoa/): Implements a transparent, borderless fullscreen overlay window using native macOS APIscocoa.m: Core Cocoa implementation with OpenGL 4.1 context, event handling, and input managementcocoa.h: C header defining the public Cocoa APIcocoa.go: Go wrapper providing the platform-agnosticCocoaWindowtypePlatform Abstraction Layer (
internal/platform/): Introduces aWindowinterface to decouple platform-specific code from the rest of the applicationwindow.go: Defines the commonWindowinterfacewindow_linux.go: Linux implementation using Wayland backendwindow_darwin.go: macOS implementation using Cocoa backendUpdated Core Modules: Refactored to use the platform-agnostic
Windowinterface instead of directly depending onwayland.WaylandWindowinternal/draw/draw.gointernal/update/update.gointernal/execute/execute.gocmd/hexecute/main.goBuild System Updates (
flake.nix): Extended Nix flake to support multiple platformsx86_64-linux,aarch64-linux,x86_64-darwin, andaarch64-darwinpostInstallstep to create a proper.appbundle with metadatamacOS App Bundle: Added proper application metadata and icon
macos/Info.plist: Bundle configuration (version, identifier, minimum OS, etc.)macos/Hexecute.icon/: Icon asset definition and PNG sourceCI/CD Updates (
.github/workflows/build.yml): Extended to build on both Ubuntu and macOS.tar.gzof the.appbundle (preserving executable bits)Documentation Updates (
README.md): Added macOS build and usage instructionsImplementation Details
//go:build darwinand//go:build linux)https://claude.ai/code/session_01LjKPHZaHPxMhLXGe55hMeW