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

Expose clear_selection function #4600

nickwynja opened this issue Jan 31, 2022 · 1 comment

Expose clear_selection function #4600

nickwynja opened this issue Jan 31, 2022 · 1 comment


Copy link

Is your feature request related to a problem? Please describe.

I have a script that takes the selection in kitty and sends it to a text file. I'd like to be able to clear the kitty text selection either from the script or from a combine action in kitty.conf.

This is what I currently have in kitty.conf:

# Don't use pass_selection_to_program since it won't call if selection is empty
# and I want to show an error message in this case to provide feedback
map cmd+shift+v launch --type background hl "@selection"

Describe the solution you'd like

I'd like the screen.clear_selection() function to be exposed so I can call it from map commands.

map cmd+shift+v combine : launch --type background hl "@selection" : clear_selection

Describe alternatives you've considered

I've tried other commands which might force the text selection to be cleared. Alternatively to calling it from the map combine, it would be nice to clear the text selection from the script so I can optionally clear or not clear based on the outcome of some logic.

Additional context

My hl script, for context:

#!/usr/bin/env bash


if [[ "$STDIN" == "" ]]; then
     ~/.dotfiles/kitty/ "Selection empty. Make sure you have the correct window selected."
    exit 1

    printf "\n\n" >> ~/Wiki/
    echo "$STDIN" | xargs | fmt | sed 's/^/\> /'  >> ~/Wiki/

Thank you for this amazing software!

Copy link

And also: 2c02699

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

No branches or pull requests

2 participants