From 241bc587837932ee77153882e7d3eceb41c200fa Mon Sep 17 00:00:00 2001 From: reidlab Date: Sat, 21 Dec 2024 18:08:48 -0800 Subject: [PATCH] wezterm ctrl+click to url --- modules/software/system/wezterm.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/modules/software/system/wezterm.nix b/modules/software/system/wezterm.nix index 6242f3f..8a84ee7 100644 --- a/modules/software/system/wezterm.nix +++ b/modules/software/system/wezterm.nix @@ -23,6 +23,7 @@ in { fonts = config.modules.desktop.fonts.fonts; in '' local wezterm = require 'wezterm' + local act = wezterm.action local config = {} @@ -43,6 +44,29 @@ in { font_size = ${toString fonts.sansSerif.size} } + config.mouse_bindings = { + -- Change the default click behavior so that it only selects + -- text and doesn't open hyperlinks + { + event = { Up = { streak = 1, button = 'Left' } }, + mods = 'NONE', + action = act.CompleteSelection 'ClipboardAndPrimarySelection' + }, + -- and make CTRL-Click open hyperlinks + { + event = { Up = { streak = 1, button = 'Left' } }, + mods = 'CTRL', + action = act.OpenLinkAtMouseCursor + }, + -- Disable the 'Down' event of CTRL-Click to avoid weird program behaviors + -- https://wezfurlong.org/wezterm/config/mouse.html#gotcha-on-binding-an-up-event-only + { + event = { Down = { streak = 1, button = 'Left' } }, + mods = 'CTRL', + action = act.Nop + } + } + return config ''; };