Skip to content

Replace desktop paste shortcut with NutJS#8

Merged
Derpedyea merged 1 commit into
mainfrom
feature/desktop-paste-shortcut
May 6, 2026
Merged

Replace desktop paste shortcut with NutJS#8
Derpedyea merged 1 commit into
mainfrom
feature/desktop-paste-shortcut

Conversation

@Derpedyea
Copy link
Copy Markdown
Member

@Derpedyea Derpedyea commented May 6, 2026

Summary

  • Swapped the desktop paste shortcut implementation from a PowerShell-based keybd_event script to @nut-tree-fork/nut-js keyboard events.
  • Added platform-aware modifier handling so paste uses Cmd+V on macOS and Ctrl+V elsewhere.
  • Updated the desktop package manifest and lockfile to include the new NutJS dependency and unpack its native libnut binaries for packaging.
  • Added additional paste logging and release error handling to make shortcut execution and cleanup more observable.

Testing

  • Not run.
  • Verified the code path change in apps/desktop/main.cjs to ensure paste now uses NutJS key presses and releases.
  • Verified apps/desktop/package.json includes @nut-tree-fork/nut-js and the asarUnpack rule for libnut binaries.

Summary by CodeRabbit

  • Bug Fixes
    • Improved clipboard paste functionality with enhanced keyboard emulation for better cross-platform compatibility and reliability.

- Replace PowerShell-based paste emulation with native keyboard input
- Add nut-js dependency and unpack its native binaries in the desktop app
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
laryn-transcribe 9d8bf08 May 06 2026, 04:03 AM

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 71ec02a9-8cdd-4252-80d5-bb50e00e3c73

📥 Commits

Reviewing files that changed from the base of the PR and between 5f8ebf1 and 9d8bf08.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • apps/desktop/main.cjs
  • apps/desktop/package.json

📝 Walkthrough

Walkthrough

The PR replaces the previous PowerShell-based clipboard paste mechanism with a native keyboard emulation approach using Nut.js library. This includes adding the Nut.js dependency, updating build configuration to unbundle native libraries, and rewriting the paste implementation to simulate platform-specific keyboard shortcuts (Cmd+V on macOS, Ctrl+V elsewhere) instead of running external scripts.

Changes

Clipboard Paste Mechanism Migration

Layer / File(s) Summary
Dependencies & Build Configuration
apps/desktop/package.json
Added @nut-tree-fork/nut-js dependency at version ^4.2.6; configured asarUnpack to unbundle native libnut binaries.
Import Updates
apps/desktop/main.cjs (lines 3–10)
Added imports for Nut.js keyboard module, uiohook-napi, and utility modules; removed prior execFile and promisify imports for PowerShell invocation.
Core Implementation
apps/desktop/main.cjs (lines 1175–1207)
pasteText() function rewritten to write text to clipboard, then simulate platform-specific paste keyboard shortcut (Cmd+V on macOS, Ctrl+V elsewhere) using Nut.js with proper key press/release sequencing and error handling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 The clipboard hops with native speed,
No PowerShell scripts to intercede—
Nut.js keyboards dance in place,
Cmd+V on every platform's face! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/desktop-paste-shortcut

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Derpedyea Derpedyea merged commit 8939f8f into main May 6, 2026
3 of 4 checks passed
@Derpedyea Derpedyea deleted the feature/desktop-paste-shortcut branch May 6, 2026 04:04
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