Make onclick trigger for both mouse and keyboard #640
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently, the
onclick
command for buttons is only executed when the button is clicked using the left mouse button. This pull request changes the behavior of theonclick
handler to also be executed if the button is activated using the keyboard (with enter or space).Usage
Here is a simple example button:
Add the snippet to your
eww.yuck
and open the widget usingYou will see a notification for both a left click as well as enter and space.
Additional Notes
Currently, the
onclick
command is activated as soon as the button is pressed. A side effect of the new implementation is that the command is now executed after the button is released.Furthermore I was not able to find an equivalent signal handler for the event box widget, hence the keyboard support is only present for the button widget.
Checklist
Please make sure you can check all the boxes that apply to this PR.
docs/content/main
directory has been adjusted to reflect my changes.cargo fmt
to automatically format all code before committing