feat(widget): add lock keys indicator - #1077
Conversation
|
You can use a custom widget for that. Why do you need a separate widget for a simple job? |
|
Thanks for the feedback. I went with a separate widget because I wanted the lock states to be read directly from Windows and update automatically without requiring users to configure an external command. I also thought having configurable state labels and state-specific CSS classes would make it easier to use and style. That said, if you prefer this to be implemented through the existing CustomWidget instead, I'm happy to rework it that way. |
|
Main issue for me is the timer. 200ms is 5 polls a second, and widgets are built per bar, so on a 3 monitor setup that's 3 timers doing the same two GetKeyState calls forever. The 50ms lower bound makes it worse. Maybe we can use our own hotkey listener for this instead of polling, we already have one in Also whatever it ends up being, it should be shared between bars instead of one instance per widget, see how CpuWidget keeps CpuWorker as a class attribute. And when I say a custom widget can do the same job, I mean you can set up a custom widget to call a PowerShell command every second and give you the same result you have now with the new widget. |
Summary
Adds a new Lock Keys widget for displaying the current Caps Lock and Num Lock states in the YASB bar.
Closes #1023
The widget:
Testing
Tested locally on Windows with YASB.
ruff check .passesruff format --check .passesAI usage
AI tools were used as an assistive aid during implementation. The resulting changes were manually reviewed, tested locally, and validated with the project's linting and formatting tools.