Skip to content

feat: add macOS (darwin) platform support - #1046

Open
jianghuawang wants to merge 1 commit into
hiroi-sora:mainfrom
jianghuawang:feature/macos-port
Open

feat: add macOS (darwin) platform support#1046
jianghuawang wants to merge 1 commit into
hiroi-sora:mainfrom
jianghuawang:feature/macos-port

Conversation

@jianghuawang

Copy link
Copy Markdown

Summary

  • Full macOS platform layer (darwin_api.py, key_translator.py) implementing the existing Api interface — shortcuts, startfile, hardware control, accessibility/screen recording permission checks
  • PySide2→PySide6 compatibility shim so the existing PySide2/Qt5 codebase runs on PySide6/Qt6 without code changes
  • Qt5Compat QML overlay for QtQuick.Dialogs version differences
  • Cross-platform entry point (main.py) — MessageBox, stdout/stderr, Qt plugin paths now handle all three platforms
  • On-demand OCR engine installer with first-launch download dialog
  • darwin_RapidOCR-json OCR plugin using RapidOCR with CoreML execution provider
  • macOS build pipeline (build.sh, create_dmg.sh) producing .app bundle and DMG

Bug fixes (not macOS-specific)

  • Fix PDF text layer missing on PyMuPDF 1.27+ — fontsize became keyword-only in page.insert_text(); the old positional call silently failed, producing PDFs with no selectable text
  • Fix Linux os.startfile() crash — linux_api.py used the Windows-only os.startfile(); replaced with xdg-open
  • Add Linux/macOS clipboard support in cmd_client.py (pbcopy/xclip)

Test plan

  • Tested on macOS — app launches, screenshot OCR, batch image OCR, batch document OCR (with text layer verified), system tray, hotkeys, HTTP API
  • The PyMuPDF fix and Linux startfile fix are cross-platform corrections that benefit all platforms

- Add darwin platform layer (darwin_api.py, key_translator.py) implementing
  the full Api interface: shortcuts, startfile, hardware control, permissions
- Add PySide2→PySide6 compatibility shim and Qt5Compat QML overlay for
  running the PySide2/Qt5 codebase on PySide6/Qt6
- Make entry point (main.py) cross-platform: MessageBox, stdout/stderr
  redirection, and Qt plugin paths now handle win32/linux/darwin
- Add macOS-specific behaviors: single-click system tray, quit-on-close
  disabled, accessibility and screen recording permission checks
- Add on-demand OCR engine installer (ocr_installer.py) with QML download
  dialog for first-launch experience on macOS
- Add darwin_RapidOCR-json OCR plugin using RapidOCR with CoreML EP
- Add macOS build pipeline (build.sh, create_dmg.sh) producing .app bundle
- Fix PDF text layer not created on PyMuPDF 1.27+ — fontsize must be passed
  as keyword argument to page.insert_text()
- Fix Linux bug: os.startfile() is Windows-only, use xdg-open instead
- Add cross-platform clipboard support (pbcopy/xclip) in cmd_client.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant