Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Add support for :keypress property to eventbox#1272

Open
AlexandrePicavet wants to merge1 commit intoelkowar:master
base:master
Choose a base branch
Loading
fromAlexandrePicavet:feat/eventbox-keypress-command

Conversation

AlexandrePicavet
Copy link

@AlexandrePicavetAlexandrePicavet commentedJan 15, 2025
edited
Loading

Description

I wanted to be able to close my window by pressing theEscape key, but I couldn't figure out how to do that, so I added a way to handlekeypress events on theeventbox widget to execute a command.

Usage

Thekeypress property is structured in the following way:

Enter |> echo 'You pressed the Enter key'

Enter : The key to press
|> : The separator
echo 'You pressed the Enter key' : The command

Here's an example of how to use it:

(defwindow my-window:monitor0:stacking"fg":exclusive false:focusable true:geometry (geometry:anchor"top left":x0:y0:width"100%":height"100%")(eventbox:keypress"Escape |> eww close my-window"(label:text"Press the Escape key to close the window")))

Showcase

eww-keypress.mp4

Additional Notes

  • I wasn't sure which syntax would be best for this feature, so if you have a different suggestion, I can change that.
  • It is my first rust contribution, so I may have done some things not quite up to the standards, if so, I'll happily fix them.
  • As shown on the video above, I added a debug log onkeypress indicating which key has been pressed and which widget caught this event. Do you find this useful, or would you prefer that I remove it ?

Checklist

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

@AlexandrePicavetAlexandrePicavet changed the titlefeat(eventbox-keypress-command): First implementationAdd support for :keypress property to eventboxJan 15, 2025
@AlexandrePicavetAlexandrePicavetforce-pushed thefeat/eventbox-keypress-command branch from3199825 toffc38feCompareJanuary 30, 2025 18:49
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@AlexandrePicavet

[8]ページ先頭

©2009-2025 Movatter.jp