Open
Conversation
Gate Linux-only dependencies (evdev, inotify) behind target_os = "linux". Make output, clipboard, paste, and notification systems cross-platform using pbcopy/pbpaste and osascript on macOS. Fix process existence check to use kill(pid, 0) instead of /proc on non-Linux platforms. Changes: - Cargo.toml: Move evdev/inotify to Linux-only target deps - cpu.rs: Gate .init_array ELF section behind cfg(target_os = "linux") - error.rs: Gate evdev error conversion behind cfg(target_os = "linux") - hotkey/mod.rs: Gate evdev_listener, return helpful error on macOS - config.rs: Use std::env::temp_dir() for portable runtime_dir fallback - output/clipboard.rs: Use pbcopy on macOS, wl-copy on Linux - output/paste.rs: Use pbcopy/pbpaste + osascript Cmd+V on macOS - output/mod.rs: Add cross-platform send_desktop_notification helper - output/dotool.rs, ydotool.rs, xclip.rs: Use notification helper - daemon.rs: Use cross-platform notification helper - main.rs: Fix /proc check, add macOS notification fallback On macOS, users disable built-in hotkey detection and use external tools (skhd, Hammerspoon) to bind voxtype record toggle to a keyboard shortcut. Audio capture (cpal/CoreAudio) and transcription (whisper-rs, remote API) work without changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
HUGE DISCLAIMER: Im not an experienced rust dev, not a macos dev neither, this was done by my clanker to make it work on my machine, i just thought it could be useful to someone. @peteonrails I saw you have a PR #129, If this brings no value please close without remorse. I don't want to add friction to this amazing tool! Thanks! |
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
evdev,inotify) behindtarget_os = "linux"so voxtype builds on macOSpbcopy/pbpasteandosascripton macOSkill(pid, 0)instead of/procon non-Linux platformsstd::env::temp_dir()for portable runtime directory fallbackOn macOS, users set
[hotkey] enabled = falseand use external tools (skhd, Hammerspoon, macOS Shortcuts) to bindvoxtype record toggleto a keyboard shortcut. Audio capture via cpal/CoreAudio and transcription (whisper-rs local or remote API) work without changes.Files changed (13 files, +265 -108)
Cargo.tomlevdev/inotifymoved to[target.'cfg(target_os = "linux")'.dependencies]src/cpu.rs.init_arrayELF constructor gated behindcfg(target_os = "linux")src/error.rsFrom<evdev::Error>gated behindcfg(target_os = "linux")src/hotkey/mod.rsevdev_listenermodule gated; non-Linuxcreate_listenerreturns helpful errorsrc/config.rsruntime_dir()usesstd::env::temp_dir()instead of hardcoded/tmpsrc/output/mod.rssend_desktop_notification()(osascript on macOS, notify-send on Linux)src/output/clipboard.rspbcopyon macOS,wl-copyon Linuxsrc/output/paste.rspbcopy/pbpaste+osascriptCmd+V on macOSsrc/output/{dotool,ydotool,xclip}.rsnotify-sendwith cross-platform helpersrc/daemon.rssrc/main.rs/proc/{pid}check replaced withkill(pid, 0); macOS notification fallbackHow it was tested on macOS
Build and unit tests
Built and tested on macOS (Apple Silicon, aarch64-apple-darwin):
Daemon setup
Since evdev hotkey detection is Linux-only, macOS requires disabling the built-in hotkey and using an external hotkey tool to send
voxtype record togglecommands to the daemon.Config (
~/.config/voxtype/config.toml):Key points:
hotkey.enabled = falsedisables the evdev listenerwhisper.mode = "remote"with OpenAI endpoint for transcription (local whisper-rs also works on macOS)output.mode = "paste"usespbcopy+osascriptto simulate Cmd+V, pasting transcribed text at the cursorStarting the daemon:
The daemon correctly uses macOS directories (
~/Library/Application Support/voxtype/for config/models,$TMPDIR/voxtype/for runtime state).Hotkey binding with skhd
skhd was used as the external hotkey daemon (any tool that can run shell commands on a keybind works):
~/.skhdrc:Requires Accessibility permissions in System Settings > Privacy & Security > Accessibility.
Simple-bar (Übersicht) status widget
A custom user widget was added to simple-bar to show daemon state in the macOS menu bar. This uses the same state file mechanism as the Waybar integration on Linux.
Status script (
~/.local/bin/voxtype-status-widget):Widget config in
~/.simplebarrc:{ "userWidgets": { "userWidgetsList": { "1": { "title": "Voxtype", "icon": "Mic", "backgroundColor": "--cyan", "output": "~/.local/bin/voxtype-status-widget", "onClickAction": "voxtype record toggle", "refreshFrequency": 500, "active": true, "hideWhenNoOutput": false } } } }The widget updates every 500ms and shows recording state visually. Clicking it toggles recording.
End-to-end recording cycle
Verified the full flow:
pbcopy, then pasted at cursor viaosascriptCmd+V simulationosascript display notificationExample daemon log from a successful cycle:
What was NOT tested
--features gpu-metal)voxtype setup systemd/voxtype setup compositor(Linux-only, but they compile fine and will just fail gracefully on macOS)Test plan
cargo build --releasesucceeds on macOS (aarch64-apple-darwin)cargo checksucceeds on macOScargo testpasses (511/512, 1 pre-existing failure unrelated to this PR)hotkey.enabled = falsevoxtype record start/stop/togglepbcopy+osascriptCmd+Vosascript🤖 Generated with Claude Code