[PR #5920] fix(desktop): add native Edit menu to enable clipboard shortcuts on Linux #5417

Open
opened 2026-03-17 02:52:02 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5920
Author: @umutkeltek
Created: 2/28/2026
Status: 🔄 Open

Base: mainHead: fix/script-editor-paste


📝 Commits (2)

  • 8ddabfc fix(desktop): add native Edit menu to enable clipboard shortcuts on Linux
  • c952e8b fix: gate Edit menu to Linux only, update comment to be platform-neutral

📊 Changes

1 file changed (+24 additions, -0 deletions)

View changed files

📝 packages/hoppscotch-desktop/src-tauri/src/lib.rs (+24 -0)

📄 Description

Description

Fixes #5871

Paste (Ctrl+V) from the system clipboard does not work in the script editor (and other editors) on the Linux desktop app. The issue is that webkit2gtk, which Tauri v2 uses as the WebView backend on Linux, requires native Edit menu items with PredefinedMenuItem accelerators for clipboard keyboard shortcuts to function properly in the WebView.

Root Cause

On Linux, webkit2gtk does not automatically connect standard clipboard keyboard shortcuts (Ctrl+V, Ctrl+C, Ctrl+X) to the system clipboard in the WebView. Without native menu items that register these accelerators, paste from external applications fails while internal clipboard (copy/paste within the app) continues to work — exactly matching the behavior reported in #5871.

Fix

Added a native Edit menu with PredefinedMenuItem items (Undo, Redo, Cut, Copy, Paste, Select All) to the Tauri app setup. These predefined menu items register the standard keyboard accelerators with the underlying platform, enabling proper clipboard integration on Linux.

This is the standard approach recommended by the Tauri ecosystem for clipboard support on Linux (tauri-apps/tauri#2397).

Changes

  • packages/hoppscotch-desktop/src-tauri/src/lib.rs: Added native Edit menu with PredefinedMenuItem items in the app setup

Testing

  • Verified the Rust code compiles without warnings (only pre-existing bundle.zip/manifest.json build artifact errors remain)
  • No JavaScript changes required — the fix operates at the native Tauri level
  • The Edit menu with clipboard accelerators enables Ctrl+V, Ctrl+C, Ctrl+X, Ctrl+A in the WebView on all platforms

Summary by cubic

Add a native Edit menu on Linux to register clipboard shortcuts in the WebView. This enables paste, copy, cut, and select-all in the script editor and other editors.

  • Bug Fixes
    • Register Undo/Redo/Cut/Copy/Paste/Select All via Tauri PredefinedMenuItem in packages/hoppscotch-desktop/src-tauri/src/lib.rs so webkit2gtk connects the WebView to the system clipboard.
    • Gate the menu to Linux with cfg!(target_os = "linux"); macOS/Windows menus are unchanged, and there are no JavaScript changes.

Written for commit c952e8b44542e9ba8ebbb285352e8f8c6b4762af. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5920 **Author:** [@umutkeltek](https://github.com/umutkeltek) **Created:** 2/28/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/script-editor-paste` --- ### 📝 Commits (2) - [`8ddabfc`](https://github.com/hoppscotch/hoppscotch/commit/8ddabfc24ccd1ab8485fc83ac8b412ebc9e75778) fix(desktop): add native Edit menu to enable clipboard shortcuts on Linux - [`c952e8b`](https://github.com/hoppscotch/hoppscotch/commit/c952e8b44542e9ba8ebbb285352e8f8c6b4762af) fix: gate Edit menu to Linux only, update comment to be platform-neutral ### 📊 Changes **1 file changed** (+24 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-desktop/src-tauri/src/lib.rs` (+24 -0) </details> ### 📄 Description ## Description Fixes #5871 Paste (Ctrl+V) from the system clipboard does not work in the script editor (and other editors) on the Linux desktop app. The issue is that webkit2gtk, which Tauri v2 uses as the WebView backend on Linux, requires native Edit menu items with `PredefinedMenuItem` accelerators for clipboard keyboard shortcuts to function properly in the WebView. ### Root Cause On Linux, webkit2gtk does not automatically connect standard clipboard keyboard shortcuts (Ctrl+V, Ctrl+C, Ctrl+X) to the system clipboard in the WebView. Without native menu items that register these accelerators, paste from external applications fails while internal clipboard (copy/paste within the app) continues to work — exactly matching the behavior reported in #5871. ### Fix Added a native Edit menu with `PredefinedMenuItem` items (Undo, Redo, Cut, Copy, Paste, Select All) to the Tauri app setup. These predefined menu items register the standard keyboard accelerators with the underlying platform, enabling proper clipboard integration on Linux. This is the standard approach recommended by the Tauri ecosystem for clipboard support on Linux ([tauri-apps/tauri#2397](https://github.com/tauri-apps/tauri/issues/2397)). ### Changes - **`packages/hoppscotch-desktop/src-tauri/src/lib.rs`**: Added native Edit menu with `PredefinedMenuItem` items in the app setup ### Testing - Verified the Rust code compiles without warnings (only pre-existing `bundle.zip`/`manifest.json` build artifact errors remain) - No JavaScript changes required — the fix operates at the native Tauri level - The Edit menu with clipboard accelerators enables Ctrl+V, Ctrl+C, Ctrl+X, Ctrl+A in the WebView on all platforms <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Add a native Edit menu on Linux to register clipboard shortcuts in the WebView. This enables paste, copy, cut, and select-all in the script editor and other editors. - **Bug Fixes** - Register Undo/Redo/Cut/Copy/Paste/Select All via Tauri `PredefinedMenuItem` in `packages/hoppscotch-desktop/src-tauri/src/lib.rs` so `webkit2gtk` connects the WebView to the system clipboard. - Gate the menu to Linux with `cfg!(target_os = "linux")`; macOS/Windows menus are unchanged, and there are no JavaScript changes. <sup>Written for commit c952e8b44542e9ba8ebbb285352e8f8c6b4762af. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5417
No description provided.