Overview
Add support for Linux platforms to SwiftAutoGUI, extending the library's cross-platform capabilities beyond macOS.
Motivation
Linux is a major platform for developers and automation tools. Supporting Linux would significantly expand SwiftAutoGUI's user base and make it a truly cross-platform automation library.
Technical Requirements
1. Platform APIs
- Replace CoreGraphics with Linux-compatible alternatives
- Investigate X11/Wayland APIs for:
- Mouse control (XWarpPointer, XTestFakeMotionEvent)
- Keyboard control (XTestFakeKeyEvent)
- Screen capture (XGetImage, XShmGetImage)
2. Dependencies
- Swift on Linux compatibility
- OpenCV for Linux (already cross-platform)
- X11 development libraries (libx11-dev, libxtst-dev)
- Potential Wayland support for modern systems
3. Implementation Tasks
Mouse Control
Keyboard Control
Screen Capture
Image Recognition
4. Build System
5. Testing
Example Implementation Structure
#if os(Linux)
import X11
import Glibc
extension SwiftAutoGUI {
public static func moveMouse(dx: Int32, dy: Int32) {
guard let display = XOpenDisplay(nil) else { return }
defer { XCloseDisplay(display) }
XWarpPointer(display, 0, 0, 0, 0, 0, 0, dx, dy)
XFlush(display)
}
}
#endif
Challenges
- Window System Diversity: Supporting both X11 and Wayland
- Permissions: Linux security models may require different approaches
- Distribution Differences: Various Linux distros handle displays differently
- Swift on Linux: Limited ecosystem compared to macOS
Success Criteria
References
Overview
Add support for Linux platforms to SwiftAutoGUI, extending the library's cross-platform capabilities beyond macOS.
Motivation
Linux is a major platform for developers and automation tools. Supporting Linux would significantly expand SwiftAutoGUI's user base and make it a truly cross-platform automation library.
Technical Requirements
1. Platform APIs
2. Dependencies
3. Implementation Tasks
Mouse Control
Keyboard Control
Screen Capture
Image Recognition
4. Build System
5. Testing
Example Implementation Structure
Challenges
Success Criteria
References