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 ''; };