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

Make onclick trigger for both mouse and keyboard #640

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

julianschuler
Copy link

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 the onclick handler to also be executed if the button is activated using the keyboard (with enter or space).

Usage

Here is a simple example button:

(defwindow example
  :monitor 0
  :focusable true
  (button :onclick "notify-send 'Hello'"
    "Test button")
)

Add the snippet to your eww.yuck and open the widget using

eww open example

You 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.

  • All widgets I've added are correctly documented.
  • I added my changes to CHANGELOG.md, if appropriate.
  • The documentation in the docs/content/main directory has been adjusted to reflect my changes.
  • I used cargo fmt to automatically format all code before committing

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

Successfully merging this pull request may close these issues.

None yet

1 participant