Skip to content

[codex] add macOS selection translator app#14

Merged
MarsDoge merged 4 commits into
mainfrom
codex/add-macos-selection-translator
Apr 25, 2026
Merged

[codex] add macOS selection translator app#14
MarsDoge merged 4 commits into
mainfrom
codex/add-macos-selection-translator

Conversation

@MarsDoge

Copy link
Copy Markdown
Owner

Summary

Adds a macOS menu-bar MVP that lets users translate or speak selected text from any app.

  • Adds macos/LLMTranslateMac, a SwiftPM AppKit menu-bar app with global hotkeys for translating (Option + Command + T) and speaking (Option + Command + S) the current selection.
  • Reuses the existing bin/llm-translate stdin/stdout CLI for translation provider dispatch instead of duplicating provider logic.
  • Adds app-bundle packaging via macos/LLMTranslateMac/scripts/build-app.sh and usage/configuration docs.
  • Makes the existing Bash CLI and provider source paths work on stock macOS by removing GNU-only readlink -f and find -printf assumptions.

Why

The existing project works well from terminal and Vim, but macOS users need a system-level workflow for text visible in any app. This PR adds that bridge while keeping provider behavior centralized in the current CLI.

Notes

The app reads selected text by temporarily issuing Command + C, reading the pasteboard, and restoring the previous pasteboard contents. It requires macOS Accessibility permission for that global selection workflow.

Validation

  • swift build in macos/LLMTranslateMac
  • ./scripts/build-app.sh in macos/LLMTranslateMac
  • bash -n bin/llm-translate install.sh scripts/render-readme-diagrams.sh lib/openai_compat.sh lib/providers/*.sh macos/LLMTranslateMac/scripts/build-app.sh
  • shellcheck bin/llm-translate install.sh scripts/render-readme-diagrams.sh lib/openai_compat.sh lib/providers/*.sh macos/LLMTranslateMac/scripts/build-app.sh
  • ./bin/llm-translate --list-providers
  • printf 'Hello, world!' | ./bin/llm-translate -p mymemory -t zh-CN

@MarsDoge MarsDoge marked this pull request as ready for review April 25, 2026 04:18
@MarsDoge MarsDoge merged commit 1cb3a32 into main Apr 25, 2026
1 check passed
@MarsDoge MarsDoge deleted the codex/add-macos-selection-translator branch April 25, 2026 04:19
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