Add macOS Shortcuts deep-link support for start/stop recording#30
Add macOS Shortcuts deep-link support for start/stop recording#30filippohronsky wants to merge 3 commits intoruzin:mainfrom
Conversation
modified: app/index.html modified: app/main.js modified: app/package.json
modified: app/main.js
ruzin
left a comment
There was a problem hiding this comment.
Thanks for the contribution, Filip! This is a well-scoped feature — routing shortcuts into the existing button handlers is a clean approach, and the cold-launch queuing + renderer-ready handshake are nice touches.
A few things that need to be addressed before merge:
Breaking: safeStorage import dropped
The PR's diff changes the require('electron') destructure and drops safeStorage, which is used elsewhere in main.js. This would break existing functionality. The fix is straightforward — just add Notification to the existing import line without removing anything.
Subprocess calls instead of existing IPC handlers
shouldShowShortcutNotifications() and isBackendRecording() both shell out via runPythonScript() to call simple_recorder.py. But main.js already has IPC handlers for both of these (get-notifications at line ~1982 and get-status at line ~407). Spawning a new Python subprocess for each is slower and creates a second code path to maintain. These should reuse the existing internal logic directly (or at minimum call the same handler functions).
No input sanitization on session name
The name query param from the URL is passed through to the renderer with only a .trim(). Since this is an externally-triggered input (any app can open a stenoai:// URL), it should have basic validation — e.g., strip path separators, limit length, restrict to alphanumeric + common punctuation.
Commit messages
The three commits all have \tmodified: <filename> as their headline, which looks like pasted git status output. Would recommend squashing into a single commit with a descriptive message on merge.
Minor: README placement
The macOS Shortcuts section is quite detailed for an optional/advanced feature. Consider wrapping it in a <details> collapse or moving to a separate doc (e.g., docs/shortcuts.md) and linking from the README.
Overall the approach is solid — the queuing, idempotent behavior, and edge case handling show good attention to detail. Just needs the above fixes and it should be good to go.
Description
This PR adds Apple macOS Shortcuts integration via
stenoai://deep links, allowing recording to be controlled from Shortcuts and automation flows.What changed
app/main.jsstenoai://record/start?name=...stenoai://record/stopopen-urlhandling with startup queueing so links work on cold and warm launchargvfallback for deep-link deliveryalready recording/already stopped)app/index.htmlshortcut-start-recording-> reuses existingstartBtn.click()shortcut-stop-recording-> reuses existingstopBtn.click()shortcut-renderer-readyhandshake eventapp/package.jsonbuild.protocolsregistration for thestenoaiURL schemeREADME.mdmacOS Shortcutssection with setup and URL examplesWhy
Enable reliable macOS Shortcut and calendar-driven automation control for recording, without changing existing recording business logic.
Type of Change
Testing
npm startManual test scenarios
stenoai://record/start?name=Daily%20Standupstenoai://record/stopCmd+Shift+Rglobal hotkey unchangedAdditional Notes
app/package-lock.jsonintentionally not modified.