wezterm ctrl+click to url

This commit is contained in:
Reid 2024-12-21 18:08:48 -08:00
parent 91aa5c41f0
commit 241bc58783
Signed by: reidlab
GPG key ID: DAF5EAF6665839FD

View file

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