From f6deadcde5aba9c700929e916165494aede06726 Mon Sep 17 00:00:00 2001 From: Joaquin Matres <4514346+joamatab@users.noreply.github.com> Date: Wed, 11 Mar 2026 08:58:52 -0500 Subject: [PATCH 1/3] change commands --- README.md | 8 ++++---- agent_cli/agents/voice_edit.py | 2 +- agent_cli/install/hotkeys.py | 6 +++--- docs/commands/autocorrect.md | 4 ++-- docs/commands/install-hotkeys.md | 6 +++--- docs/commands/transcribe.md | 2 +- docs/commands/voice-edit.md | 4 ++-- docs/getting-started.md | 2 +- docs/index.md | 2 +- docs/system-integration.md | 6 +++--- scripts/macos-hotkeys/README.md | 6 +++--- scripts/macos-hotkeys/skhd-config-example | 4 ++-- scripts/setup-macos-hotkeys.sh | 12 ++++++------ 13 files changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 5f779f6d4..c5ca63781 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ I got tired of typing long prompts to LLMs. Speaking is faster, so I built this **What it does:** -- Voice transcription to clipboard with system-wide hotkeys (Cmd+Shift+R on macOS) +- Voice transcription to clipboard with system-wide hotkeys (Cmd+Shift+1 on macOS) - Autocorrect any text from your clipboard - Edit clipboard content with voice commands ("make this more formal") - Runs locally - no internet required, your audio stays on your machine @@ -265,9 +265,9 @@ This script automatically: - ✅ Installs Homebrew if not present - ✅ Installs skhd (hotkey daemon) and terminal-notifier - ✅ Configures these system-wide hotkeys: - - **`Cmd+Shift+R`** - Toggle voice transcription - - **`Cmd+Shift+A`** - Autocorrect clipboard text - - **`Cmd+Shift+V`** - Voice edit clipboard text + - **`Cmd+Shift+1`** - Toggle voice transcription + - **`Cmd+Shift+2`** - Autocorrect clipboard text + - **`Cmd+Shift+\``** - Voice edit clipboard text > [!NOTE] > After setup, you may need to grant Accessibility permissions to skhd in System Settings → Privacy & Security → Accessibility diff --git a/agent_cli/agents/voice_edit.py b/agent_cli/agents/voice_edit.py index 0703cef95..e7def8c27 100644 --- a/agent_cli/agents/voice_edit.py +++ b/agent_cli/agents/voice_edit.py @@ -12,7 +12,7 @@ KEYBOARD MAESTRO INTEGRATION: To create a hotkey toggle for this script, set up a Keyboard Maestro macro with: -1. Trigger: Hot Key (e.g., Cmd+Shift+A for "Assistant") +1. Trigger: Hot Key (e.g., Cmd+Shift+` for "Voice Edit") 2. If/Then/Else Action: - Condition: Shell script returns success diff --git a/agent_cli/install/hotkeys.py b/agent_cli/install/hotkeys.py index 20b1de593..2b8a91c5a 100644 --- a/agent_cli/install/hotkeys.py +++ b/agent_cli/install/hotkeys.py @@ -17,9 +17,9 @@ def install_hotkeys() -> None: | Hotkey (macOS / Linux) | Action | |-------------------------|-------------------------------------------------| - | Cmd/Super + Shift + R | Toggle voice transcription (start/stop) | - | Cmd/Super + Shift + A | Autocorrect clipboard text (grammar/spelling) | - | Cmd/Super + Shift + V | Voice edit clipboard text (voice commands) | + | Cmd/Super + Shift + 1 | Toggle voice transcription (start/stop) | + | Cmd/Super + Shift + 2 | Autocorrect clipboard text (grammar/spelling) | + | Cmd/Super + Shift + ` | Voice edit clipboard text (voice commands) | **macOS** (fully automatic): diff --git a/docs/commands/autocorrect.md b/docs/commands/autocorrect.md index 4d2f53211..f78d2bf3e 100644 --- a/docs/commands/autocorrect.md +++ b/docs/commands/autocorrect.md @@ -91,7 +91,7 @@ Set up a hotkey to run autocorrect on your clipboard: === "macOS (skhd)" ``` - cmd + shift + a : /path/to/agent-cli autocorrect + cmd + shift - 2 : /path/to/agent-cli autocorrect ``` === "Linux (Hyprland)" @@ -103,5 +103,5 @@ Set up a hotkey to run autocorrect on your clipboard: ### Typical Usage 1. Select and copy text with errors -2. Press your hotkey (e.g., Cmd+Shift+A) +2. Press your hotkey (e.g., Cmd+Shift+2) 3. Paste the corrected text diff --git a/docs/commands/install-hotkeys.md b/docs/commands/install-hotkeys.md index b34dc6e18..d62087c41 100644 --- a/docs/commands/install-hotkeys.md +++ b/docs/commands/install-hotkeys.md @@ -18,9 +18,9 @@ Sets up hotkeys for common workflows: **macOS:** -- Cmd+Shift+R: Toggle voice transcription -- Cmd+Shift+A: Autocorrect clipboard text -- Cmd+Shift+V: Voice edit clipboard text +- Cmd+Shift+1: Toggle voice transcription +- Cmd+Shift+2: Autocorrect clipboard text +- Cmd+Shift+`: Voice edit clipboard text **Linux:** diff --git a/docs/commands/transcribe.md b/docs/commands/transcribe.md index d67229195..48eee3489 100644 --- a/docs/commands/transcribe.md +++ b/docs/commands/transcribe.md @@ -182,7 +182,7 @@ agent-cli transcribe --toggle ### macOS Hotkey (skhd) ``` -cmd + shift + r : /path/to/agent-cli transcribe --toggle --input-device-index 1 +cmd + shift - 1 : /path/to/agent-cli transcribe --toggle --input-device-index 1 ``` ### Transcription Log diff --git a/docs/commands/voice-edit.md b/docs/commands/voice-edit.md index 06f9354ac..188a2dcaf 100644 --- a/docs/commands/voice-edit.md +++ b/docs/commands/voice-edit.md @@ -179,8 +179,8 @@ agent-cli voice-edit --stop ### macOS (skhd) ``` -# Toggle voice-edit with Cmd+Shift+V -cmd + shift + v : /path/to/agent-cli voice-edit --toggle --input-device-index 1 +# Toggle voice-edit with Cmd+Shift+` +cmd + shift - ` : /path/to/agent-cli voice-edit --toggle --input-device-index 1 ``` ### Linux (Hyprland) diff --git a/docs/getting-started.md b/docs/getting-started.md index f27f2b6c9..713d83abc 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -147,7 +147,7 @@ For detailed installation instructions, see the platform-specific guides: Here's a typical workflow for using voice transcription: 1. **Copy some text** you want to respond to (e.g., an email) -2. **Press your hotkey** (Cmd+Shift+R on macOS) to start recording +2. **Press your hotkey** (Cmd+Shift+1 on macOS) to start recording 3. **Speak your response** naturally 4. **Press the hotkey again** to stop recording 5. **Paste** the transcribed text wherever you need it diff --git a/docs/index.md b/docs/index.md index 49aa1efe3..6f9c75d67 100644 --- a/docs/index.md +++ b/docs/index.md @@ -37,7 +37,7 @@ I got tired of typing long prompts to LLMs. Speaking is faster, so I built this **What it does:** -- Voice transcription to clipboard with system-wide hotkeys (Cmd+Shift+R on macOS) +- Voice transcription to clipboard with system-wide hotkeys (Cmd+Shift+1 on macOS) - Autocorrect any text from your clipboard - Edit clipboard content with voice commands ("make this more formal") - Runs locally - no internet required, your audio stays on your machine diff --git a/docs/system-integration.md b/docs/system-integration.md index a139ac9e1..8e94c32e9 100644 --- a/docs/system-integration.md +++ b/docs/system-integration.md @@ -32,13 +32,13 @@ Create or edit `~/.config/skhd/skhdrc`: ```bash # Transcribe to clipboard (toggle recording) -cmd + shift + r : /path/to/agent-cli transcribe --toggle --input-device-index 1 +cmd + shift - 1 : /path/to/agent-cli transcribe --toggle --input-device-index 1 # Autocorrect clipboard -cmd + shift + a : /path/to/agent-cli autocorrect +cmd + shift - 2 : /path/to/agent-cli autocorrect # Voice edit clipboard -cmd + shift + v : /path/to/agent-cli voice-edit --toggle --input-device-index 1 +cmd + shift - ` : /path/to/agent-cli voice-edit --toggle --input-device-index 1 # Speak clipboard cmd + shift + s : /path/to/agent-cli speak diff --git a/scripts/macos-hotkeys/README.md b/scripts/macos-hotkeys/README.md index 3eb9aea16..047504093 100644 --- a/scripts/macos-hotkeys/README.md +++ b/scripts/macos-hotkeys/README.md @@ -10,9 +10,9 @@ System-wide hotkeys for agent-cli voice AI features on macOS. ## Usage -- **`Cmd+Shift+R`** → Toggle voice transcription (start/stop with result) -- **`Cmd+Shift+A`** → Autocorrect clipboard text -- **`Cmd+Shift+V`** → Toggle voice edit mode for clipboard +- **`Cmd+Shift+1`** → Toggle voice transcription (start/stop with result) +- **`Cmd+Shift+2`** → Autocorrect clipboard text +- **`Cmd+Shift+\``** → Toggle voice edit mode for clipboard Results appear in notifications and clipboard. diff --git a/scripts/macos-hotkeys/skhd-config-example b/scripts/macos-hotkeys/skhd-config-example index 4b18d0b34..67023a5d1 100644 --- a/scripts/macos-hotkeys/skhd-config-example +++ b/scripts/macos-hotkeys/skhd-config-example @@ -1,5 +1,5 @@ # Simple skhd configuration for transcription toggle # Save to ~/.config/skhd/skhdrc -# Press Cmd+Shift+R to toggle transcription -cmd + shift - r : /path/to/toggle-transcription.sh +# Press Cmd+Shift+1 to toggle transcription +cmd + shift - 1 : /path/to/toggle-transcription.sh diff --git a/scripts/setup-macos-hotkeys.sh b/scripts/setup-macos-hotkeys.sh index 0ad572b7e..f21c1308f 100755 --- a/scripts/setup-macos-hotkeys.sh +++ b/scripts/setup-macos-hotkeys.sh @@ -31,9 +31,9 @@ VOICE_EDIT_SCRIPT="$SCRIPT_DIR/macos-hotkeys/toggle-voice-edit.sh" cat > ~/.config/skhd/skhdrc << EOF # Agent-CLI Hotkeys -cmd + shift - r : "$TRANSCRIBE_SCRIPT" -cmd + shift - a : "$AUTOCORRECT_SCRIPT" -cmd + shift - v : "$VOICE_EDIT_SCRIPT" +cmd + shift - 1 : "$TRANSCRIBE_SCRIPT" +cmd + shift - 2 : "$AUTOCORRECT_SCRIPT" +cmd + shift - \` : "$VOICE_EDIT_SCRIPT" EOF # Start service @@ -46,9 +46,9 @@ terminal-notifier -title "⌨️ Setup Complete" -message "Agent-CLI hotkeys rea echo "" echo "✅ Done! Hotkeys:" -echo " Cmd+Shift+R - Transcribe voice" -echo " Cmd+Shift+A - Autocorrect clipboard" -echo " Cmd+Shift+V - Voice edit clipboard" +echo " Cmd+Shift+1 - Transcribe voice" +echo " Cmd+Shift+2 - Autocorrect clipboard" +echo " Cmd+Shift+\` - Voice edit clipboard" echo "" echo "If the hotkey doesn't work:" echo "1. Open System Settings → Privacy & Security → Accessibility" From e7b8301ac5dffe57fde5bf9a40be81bc9e5f732a Mon Sep 17 00:00:00 2001 From: Joaquin Matres <4514346+joamatab@users.noreply.github.com> Date: Wed, 11 Mar 2026 09:00:44 -0500 Subject: [PATCH 2/3] change --- scripts/setup-macos-hotkeys.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup-macos-hotkeys.sh b/scripts/setup-macos-hotkeys.sh index f21c1308f..38982c9c6 100755 --- a/scripts/setup-macos-hotkeys.sh +++ b/scripts/setup-macos-hotkeys.sh @@ -33,7 +33,7 @@ cat > ~/.config/skhd/skhdrc << EOF # Agent-CLI Hotkeys cmd + shift - 1 : "$TRANSCRIBE_SCRIPT" cmd + shift - 2 : "$AUTOCORRECT_SCRIPT" -cmd + shift - \` : "$VOICE_EDIT_SCRIPT" +cmd + shift - 0x32 : "$VOICE_EDIT_SCRIPT" EOF # Start service From a3e19187cb99094abb1ec5789153cba01184ffb9 Mon Sep 17 00:00:00 2001 From: Joaquin Matres <4514346+joamatab@users.noreply.github.com> Date: Wed, 11 Mar 2026 11:24:36 -0500 Subject: [PATCH 3/3] show mic when it changes --- .gitignore | 1 + scripts/macos-hotkeys/menubar-icon.swift | 30 ++++++++++++++ scripts/macos-hotkeys/toggle-transcription.sh | 41 ++++++++++++++++--- 3 files changed, 66 insertions(+), 6 deletions(-) create mode 100755 scripts/macos-hotkeys/menubar-icon.swift diff --git a/.gitignore b/.gitignore index 2cf97c476..178cca93b 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,7 @@ examples/piper-data/ examples/whisper-data/ examples/ollama/id_ed25519* scripts/.runtime/ +scripts/macos-hotkeys/menubar-icon *.onnx *.onnx.json *.bin diff --git a/scripts/macos-hotkeys/menubar-icon.swift b/scripts/macos-hotkeys/menubar-icon.swift new file mode 100755 index 000000000..68fbb03c2 --- /dev/null +++ b/scripts/macos-hotkeys/menubar-icon.swift @@ -0,0 +1,30 @@ +#!/usr/bin/env swift +// Minimal menu bar icon that shows while recording. +// Usage: menubar-icon [icon] [tooltip] +// Exits on SIGTERM or SIGINT. Kill the process to remove the icon. + +import AppKit + +let icon = CommandLine.arguments.count > 1 ? CommandLine.arguments[1] : "🎙️" +let tooltip = CommandLine.arguments.count > 2 ? CommandLine.arguments[2] : "agent-cli: recording" + +let app = NSApplication.shared +app.setActivationPolicy(.accessory) + +let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) +statusItem.button?.title = icon +statusItem.button?.toolTip = tooltip + +// Use DispatchSource for safe signal handling on the main queue +signal(SIGTERM, SIG_IGN) +signal(SIGINT, SIG_IGN) + +let sigterm = DispatchSource.makeSignalSource(signal: SIGTERM, queue: .main) +sigterm.setEventHandler { NSApp.terminate(nil) } +sigterm.resume() + +let sigint = DispatchSource.makeSignalSource(signal: SIGINT, queue: .main) +sigint.setEventHandler { NSApp.terminate(nil) } +sigint.resume() + +app.run() diff --git a/scripts/macos-hotkeys/toggle-transcription.sh b/scripts/macos-hotkeys/toggle-transcription.sh index 94a1cc571..65adbbda3 100755 --- a/scripts/macos-hotkeys/toggle-transcription.sh +++ b/scripts/macos-hotkeys/toggle-transcription.sh @@ -1,17 +1,20 @@ #!/usr/bin/env bash # Toggle script for agent-cli transcription on macOS +# Shows a subtle menu bar icon while recording instead of notification banners. NOTIFIER=${NOTIFIER:-/opt/homebrew/bin/terminal-notifier} AGENT_CLI=${AGENT_CLI:-"$HOME/.local/bin/agent-cli"} PID_FILE=${PID_FILE:-"$HOME/.cache/agent-cli/transcribe.pid"} -RECORDING_GROUP="agent-cli-transcribe-recording" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +MENUBAR_ICON="$SCRIPT_DIR/menubar-icon" +MENUBAR_PID_FILE="$HOME/.cache/agent-cli/menubar-icon.pid" TEMP_PREFIX="agent-cli-transcribe-temp" notify_temp() { local title=$1 local message=$2 - local duration=${3:-4} # 4 seconds default + local duration=${3:-4} local group="${TEMP_PREFIX}-${RANDOM}-$$" "$NOTIFIER" -title "$title" -message "$message" -group "$group" @@ -21,6 +24,31 @@ notify_temp() { ) & } +show_menubar_icon() { + # Compile on first use if binary doesn't exist + if [ ! -x "$MENUBAR_ICON" ] && [ -f "$MENUBAR_ICON.swift" ]; then + swiftc -O "$MENUBAR_ICON.swift" -o "$MENUBAR_ICON" 2>/dev/null + fi + if [ -x "$MENUBAR_ICON" ]; then + "$MENUBAR_ICON" "🎙️" "agent-cli: recording" & + echo $! > "$MENUBAR_PID_FILE" + fi +} + +hide_menubar_icon() { + # Kill by PID file + if [ -f "$MENUBAR_PID_FILE" ]; then + local pid + pid=$(cat "$MENUBAR_PID_FILE" 2>/dev/null || true) + if [ -n "$pid" ]; then + kill "$pid" >/dev/null 2>&1 || true + fi + rm -f "$MENUBAR_PID_FILE" + fi + # Fallback: kill any remaining instances + pkill -x menubar-icon >/dev/null 2>&1 || true +} + is_transcribe_running() { [ -f "$PID_FILE" ] || return 1 local pid @@ -30,14 +58,15 @@ is_transcribe_running() { if is_transcribe_running; then "$AGENT_CLI" transcribe --toggle --quiet >/dev/null 2>&1 || true - - "$NOTIFIER" -remove "$RECORDING_GROUP" >/dev/null 2>&1 || true + hide_menubar_icon notify_temp "🛑 Stopped" "Processing results..." else - "$NOTIFIER" -title "🎙️ Started" -message "Listening..." -group "$RECORDING_GROUP" + # Clean up any stale icon from a previous run + hide_menubar_icon + show_menubar_icon ( OUTPUT=$("$AGENT_CLI" transcribe --toggle --llm --quiet 2>/dev/null) - "$NOTIFIER" -remove "$RECORDING_GROUP" >/dev/null 2>&1 || true + hide_menubar_icon if [ -n "$OUTPUT" ]; then notify_temp "📄 Result" "$OUTPUT" else