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

add a module to detect if caps lock is on #4561

Open
grimm26 opened this issue Nov 4, 2022 · 3 comments
Open

add a module to detect if caps lock is on #4561

grimm26 opened this issue Nov 4, 2022 · 3 comments
Labels
✨ enhancement A new feature implementation.

Comments

@grimm26
Copy link

grimm26 commented Nov 4, 2022

Feature Request

It would be nice to get an indication in my prompt if caps lock is enabled.

@grimm26 grimm26 added the ✨ enhancement A new feature implementation. label Nov 4, 2022
@grimm26
Copy link
Author

grimm26 commented Nov 26, 2022

https://stackoverflow.com/questions/49561510/how-to-detect-the-status-of-the-capslock-in-linux-programmatically seems to have some good info, but I don't know how to do this in rust

@chipbuster
Copy link
Contributor

This is a neat idea, but I see a few challenges with it:

  1. We can't just detect capslock on a single platform, we need to be able to do it across all our supported platforms. At a minimum, this means
  • Linux X11
  • Linux Wayland
  • Linux TTY
  • MacOS
  • Windows
  • BSD X11
  • Android (does Termux even have the concept of a Caps Lock?)
  1. We can't trigger a redraw of starship from within the Rust code--only the shell that we're working with can trigger a redraw of the prompt. That means that we need some mechanism for triggering a prompt redraw upon Caps ON/OFF for all 10 of the shells we currently support.

I'll be honest---this seems like a pretty daunting list of requirements to fulfill, but if someone can do it without making the existing code ridiculously complex, it might be worth merging. A simpler way to handle item 1 might be to rely on reading environment data out of the host shell (similar to how the jobs and cmd_duration module currently work), but I have no idea how you could implement item 2 at the moment.

@grimm26
Copy link
Author

grimm26 commented Dec 3, 2022

Agreed that it is not easy, especially considering we are looking at a cross-platform tool. This is kind of a wish-list item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement A new feature implementation.
Projects
None yet
Development

No branches or pull requests

2 participants