From e7ba8da29ab27a6f0875c4b99245ef4dc5a3dbbb Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Mon, 8 Jun 2026 02:22:32 +0300 Subject: [PATCH] fix: use cmd-click for macos pane links refs #307 --- docs/next/CHANGELOG.md | 1 + src/app/input/mod.rs | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/next/CHANGELOG.md b/docs/next/CHANGELOG.md index 1214b4d4..3c5f2140 100644 --- a/docs/next/CHANGELOG.md +++ b/docs/next/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased ### Fixed +- Native pane URL clicks now use Cmd-click on macOS and Ctrl-click on other platforms. - Windows beta installs now default to the preview channel, persist `channel = "preview"` during install, reject switching to stable until stable Windows builds exist, and update through the Windows installer without probing unsupported live-handoff/session status paths. - Pane output now renders flag emoji and other multi-codepoint grapheme clusters as complete symbols instead of blank cells. (#243) - Starting Herdr with no restored workspaces, or closing the last workspace, now opens a default workspace instead of leaving the client on an empty screen where direct keybindings such as `cmd+n` were shown but ignored. (#366) diff --git a/src/app/input/mod.rs b/src/app/input/mod.rs index 59fa1ccd..1fc7b0f9 100644 --- a/src/app/input/mod.rs +++ b/src/app/input/mod.rs @@ -23,6 +23,26 @@ enum WheelRouting { const WORKSPACE_DRAG_THRESHOLD: u16 = 1; const TAB_DRAG_THRESHOLD: u16 = 1; +#[cfg(target_os = "macos")] +fn modified_url_click_modifier() -> KeyModifiers { + KeyModifiers::SUPER +} + +#[cfg(not(target_os = "macos"))] +fn modified_url_click_modifier() -> KeyModifiers { + KeyModifiers::CONTROL +} + +#[cfg(test)] +#[test] +fn modified_url_click_modifier_matches_platform_primary_modifier() { + #[cfg(target_os = "macos")] + assert_eq!(modified_url_click_modifier(), KeyModifiers::SUPER); + + #[cfg(not(target_os = "macos"))] + assert_eq!(modified_url_click_modifier(), KeyModifiers::CONTROL); +} + mod copy_mode; mod modal; mod mouse; @@ -262,7 +282,7 @@ impl App { fn handle_modified_url_click(&mut self, mouse: MouseEvent) -> bool { if self.state.mode != Mode::Terminal || !matches!(mouse.kind, MouseEventKind::Down(MouseButton::Left)) - || !mouse.modifiers.contains(KeyModifiers::CONTROL) + || !mouse.modifiers.contains(modified_url_click_modifier()) { return false; }