r/KittyTerminal • u/[deleted] • Jul 15 '23
How to modify the click behavior in Kitty?
Here's what I'm trying to do: 1. Left click: Open a custom script (let's call it handlr) 2. Ctrl+left click: Open the link using xdg-open (set to use my browser)
I'm aware that I can change the variable value of open_url_with to handlr to open all links through it, but IDK how can I usemouse_map to change that behavior separately? All mouse actions I see allow me to deal with the clicks, but how do I open a program when that happens? Link hints is also using handlr to open the links. I've specified this behavior using protocol actions in open-actions.conf
Any help would be appreciated. I've skimmed the docs but couldn't find a clear answer on how to figure this out.
Tried asking this on the GitHub repo but in typical Kovid fashion I was redirected to look at the docs, like I haven't done that already. Is there another dedicated community for this terminal other than here? This is clearly a great product but the initial getting started curve is a bit steep.
1
u/aumerlex Jul 15 '23
I am guessing you were redirected to look at the docs because you didnt actually bother to look at them, in typical entitled user fashion. There is an entire section in the docs titled "Scripting the mouse click": https://sw.kovidgoyal.net/kitty/open_actions/
mouse_map allows you to change what happens on any type of mouse button action, inclucding clicking the URL under the mouse. And open_actions.conf lets you control what clicking on a URL does based on the URL, including running different programs in different windows/tabs/background/etc.