Skip to content

feat: Gesture configuration in shortcuts config #63

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

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

Conversation

ryanabx
Copy link

@ryanabx ryanabx commented Dec 20, 2024

This commit adds a Gesture abstraction, which can define gestures by the number of fingers used, and the direction the gesture is performed in.

The abstraction is modeled after the Binding type, and the resulting Gestures type is similar to the Shortcuts type.

This is the first step in implementing configurable touchpad gestures (pop-os/cosmic-comp#396)

Let me know what needs to be changed!

@ryanabx
Copy link
Author

ryanabx commented Jan 26, 2025

Rebased on latest master. Can I get a review soon if there's any free time?


impl Gesture {
/// Creates a new gesture from a number of fingers and a direction
pub fn new(fingers: impl Into<u32>, direction: impl Into<Direction>) -> Gesture {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's a need for generic input parameters here. Use of constant types will prevent unnecessary monomorphization and inlining.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in v3. Also made fingers an enum, to limit the fingers that can be used as gestures. Unsure if this is something we want or not

let mut gestures = context
.get::<Gestures>("default_gestures")
.unwrap_or_else(|why| {
tracing::error!("shortcuts defaults config error: {why:?}");
Copy link
Member

@mmstick mmstick Mar 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use if why.is_err() {} to check if the error is worth logging. Otherwise this will spam the logs if the config is not in use.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in v2.

I assume I shouldn't do the same for the custom gestures?

@ryanabx ryanabx force-pushed the gestures branch 3 times, most recently from 34c9e55 to fdf1f1b Compare May 24, 2025 18:48
This commit adds a Gesture abstraction, which can define gestures by the
number of fingers used, and the direction the gesture is performed in.

The abstraction is modeled after the Binding type, and the resulting
Gestures type is similar to the Shortcuts type.

This is the first step in implementing configurable touchpad gestures
(pop-os/cosmic-comp#396)

Signed-off-by: Ryan Brue <[email protected]>
@ryanabx ryanabx requested a review from mmstick May 24, 2025 18:49
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.

2 participants