fix(terminal): restore terminal text copy behavior (#452)

* fix(terminal): restore terminal text copy behavior

* fix(desktop): route Cmd+C through terminal-aware copy handler on macOS

- Use a custom macOS Copy menu action to dispatch app copy events first, so terminal selections copy without native “no target” beep, while preserving DOM copy fallback for non-terminal contexts.

---------

Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
shekohex
2026-02-20 13:23:01 +02:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent 7bcf848035
commit 881e8bdf4f
4 changed files with 73 additions and 39 deletions
+8 -1
View File
@@ -98,6 +98,8 @@ const MENU_ITEM_OPEN_FILES_TAB_ID: &str = "menu_open_files_tab";
#[cfg(target_os = "macos")]
const MENU_ITEM_OPEN_TERMINAL_TAB_ID: &str = "menu_open_terminal_tab";
#[cfg(target_os = "macos")]
const MENU_ITEM_COPY_ID: &str = "menu_copy";
#[cfg(target_os = "macos")]
const MENU_ITEM_THEME_LIGHT_ID: &str = "menu_theme_light";
#[cfg(target_os = "macos")]
const MENU_ITEM_THEME_DARK_ID: &str = "menu_theme_dark";
@@ -218,6 +220,7 @@ fn build_macos_menu<R: tauri::Runtime>(
true,
Some("Cmd+T"),
)?;
let copy = MenuItem::with_id(app, MENU_ITEM_COPY_ID, "Copy", true, Some("Cmd+C"))?;
let theme_light =
MenuItem::with_id(app, MENU_ITEM_THEME_LIGHT_ID, "Light Theme", true, None::<&str>)?;
@@ -353,7 +356,7 @@ fn build_macos_menu<R: tauri::Runtime>(
&PredefinedMenuItem::redo(app, None)?,
&PredefinedMenuItem::separator(app)?,
&PredefinedMenuItem::cut(app, None)?,
&PredefinedMenuItem::copy(app, None)?,
&copy,
&PredefinedMenuItem::paste(app, None)?,
&PredefinedMenuItem::select_all(app, None)?,
],
@@ -2462,6 +2465,10 @@ fn main() {
dispatch_menu_action(app, "open-terminal-tab");
return;
}
if id == MENU_ITEM_COPY_ID {
dispatch_menu_action(app, "copy");
return;
}
if id == MENU_ITEM_THEME_LIGHT_ID {
dispatch_menu_action(app, "theme-light");