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

Allow shell integration scripts to request prompt click events #7847

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pianohacker
Copy link
Contributor

This is done via the prompt-click-events keyword in $KITTY_SHELL_INTEGRATION.

Also adds the $KITTY_SUPPORTS_PROMPT_CLICK_EVENTS environment variable, which scripts can use to check for support before requesting click events.

Note that the fish integration script is intentionally not modified, as the fish integration seems to be built-in in newer versions.

This is done via the `prompt-click-events` keyword in
`$KITTY_SHELL_INTEGRATION`.

Also adds the `$KITTY_SUPPORTS_PROMPT_CLICK_EVENTS` environment
variable, which scripts can use to check for support before requesting
click events.

Note that the fish integration script is intentionally not modified, as
the fish integration seems to be built-in in newer versions.
@kovidgoyal
Copy link
Owner

IMO rather than adding this as a shell integration option, instead look for some shell global variable in the integration scripts and if it is set send click_events with the prompt marking. Then the user only has to configure click support in one place, his rc files, to load the click support code. That code in turn should set the shell global variable and the shell integration scripts should read the variable.

@pianohacker
Copy link
Contributor Author

The approach I took was based on this comment. My reading of that was that zsh themes / rc files should append to $KITTY_SHELL_INTEGRATION to change behavior; is that not what it means? Would you rather I use a separate environment variable regardless?

@kovidgoyal
Copy link
Owner

This is not a shell integration feature so much as a shell capability.
If the shell supports handling of click events, shell integration should
enable it automatically, if not it should fallback to fake arrow key
events. So currently zsh does not support this functionality natively but
it can be patched to do so via zshrc, but in the future zsh may gain
this functionality natively. The shell integration script should thus
just check if zsh has been patched to support click events and if so
enable that functionality. In the future if zsh gains this natively,
theintegration script can check the zsh version and turn on the
functionality based on that.

@pianohacker
Copy link
Contributor Author

I understand your reasoning, but I'm not sure what mechanism you're proposing. Checking zsh version for the future where zsh supports this natively is one thing. For the in-between times, though, where folks would need to use something like https://github.com/stephane-chazelas/misc-scripts/blob/master/mouse.zsh , how should the shell integration script be told that this patching has been done? Should there be a separate environment variable like $KITTY_SHELL_INTEGRATION_SEND_MOUSE_EVENTS that the shell integration script listens to?

@kovidgoyal
Copy link
Owner

User cources that script and sets a non exported env var or zsh global.
The shell integration script checks for that, and turn on clicks if it
is present.

@kovidgoyal kovidgoyal force-pushed the master branch 2 times, most recently from dc27691 to 63df210 Compare September 29, 2024 16:14
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

Successfully merging this pull request may close these issues.

2 participants