Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openurlonclick: only underline links when url_opener_modkey is pressed #157

Open
UtkarshVerma opened this issue Nov 23, 2024 · 1 comment

Comments

@UtkarshVerma
Copy link
Contributor

I noticed that in config.h, we have url_opener_modkey which specifies whether pressing any modkey is required for opening URLs. I think, from a usage perspective, it would make more sense if the patch's behaviour is only affects the terminal when the modkey is pressed.

For example, with the modkey as Ctrl, I only want hovered links to be underlined if Ctrl is held down, which is how all other terminal emulators do it.

I plan to make a PR for this. From what I can see in the source, I think changing the following line should be enough:
https://github.com/bakkeby/st-flexipatch/blob/master/x.c#L2620

We just make sure that url_draw also accommodates matching the Ctrl keypress state. It would be great if you could verify and outline what needs to be done so that I can work up a PR over this weekend.

@veltza
Copy link
Contributor

veltza commented Nov 23, 2024

For example, with the modkey as Ctrl, I only want hovered links to be underlined if Ctrl is held down, which is how all other terminal emulators do it.

What do you mean by all terminal emulators, since xfce4-terminal and Konsole behave the same way as the openurlonclick patch?

So maybe it's better to add a new setting to config.def.h that controls that behavior rather than changing the current one? Would you have any name suggestions for the setting?

I plan to make a PR for this. From what I can see in the source, I think changing the following line should be enough:
https://github.com/bakkeby/st-flexipatch/blob/master/x.c#L2620

It's not enough because the mouse cursor must also be prevented from changing into the hand shape. I need to look at that code to see what kind of changes it would require.

Edit: My hunch was right. This cannot be solved with just one line. Here's my progress and I'm not even done yet:

$ git diff --stat
 x.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 70 insertions(+), 15 deletions(-)

It's always hard to change something that's designed to work very differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants