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

Feature request / question: Get modifier keys on keyboard event #5318

Closed
novak-services opened this issue Dec 2, 2024 · 4 comments
Closed

Comments

@novak-services
Copy link

To fully support the keyboard in my application, I would need to be able to get the current state of the modifier keys (shift,control,meta).

The key event does not provide that. For example if I press the return key, I see no difference if I press return with or without space key.

Interestingly Mouse events seem to support it, but I do not want to wait for a mouse event to fire -- the interactions should be triggered from the keyboard alone.

It also could be a separate function to get that state, but it really would make my application possible, since I would need to find another way of implementing it, if it is not possible in textual.

Is there a way to do that already (I scanned the documentation and FAQ but found nothing yet)? If not, would it be possible to integrate such a functionality in reasonable time?

Could that be available with "Extended keys" #3411 ? That would also be a possibility for me, to use such a terminal, but I saw no possibility to integrate it into the current Key event structure, so I did not try a terminal with that support yet.

Any response would be appreciated.

Copy link

github-actions bot commented Dec 2, 2024

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@willmcgugan
Copy link
Collaborator

Modifiers are encoded in the key name, but you will need a terminal that supports the extended key protocol to use them.

Screenshot 2024-12-02 at 16 38 44

@novak-services
Copy link
Author

Thank you VERY MUCH.

That was really helpful. I tried it with WezTerm and works like a charm and I get now all information my Application needs.

I am getting more and more into Textual and it is real great.

Copy link

github-actions bot commented Dec 4, 2024

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

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