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

mouse() does not chain with itself #941

Closed
umnikos opened this issue Aug 17, 2024 · 3 comments
Closed

mouse() does not chain with itself #941

umnikos opened this issue Aug 17, 2024 · 3 comments

Comments

@umnikos
Copy link

umnikos commented Aug 17, 2024

While mouse(left, 10) and mouse(up, 10) both work, it's currently impossible to have a keyboard key that sends the mouse up and to the left. mouse(left, 10).mouse(up, 10) only moves the mouse left.

As there are only 4 such combined directions, an alternate way to have the same functionality would be to have mouse() accept 4 additional direction strings: up_left, up_right, down_left, down_right

@sezanzeb
Copy link
Owner

sezanzeb commented Jan 1, 2025

I should have designed the mouse macro to allow something like mouse(x=10, y=5).

You can, however, do something like

hold(
  event(EV_REL, REL_X, 1)
  .event(EV_REL, REL_Y, 2)
  .wait(10)
)

@sezanzeb
Copy link
Owner

sezanzeb commented Jan 1, 2025

You could even make it accelerate like this:

set(speed, 0)
.hold(
  event(EV_REL, REL_X, $speed)
  .event(EV_REL, REL_Y, $speed)
  .add(speed, 1)
  .wait(20)
)

or

set(speed, 50)
.hold(
  event(EV_REL, REL_X, 1)
  .event(EV_REL, REL_Y, 2)
  .add(speed, -1)
  .wait($speed)
)

Though all of those aren't as smooth as the mouse macro.

This was referenced Jan 1, 2025
@sezanzeb
Copy link
Owner

sezanzeb commented Jan 12, 2025

If you install from the latest main, you can now use mouse_xy(10, 10)

Or, you can do

parallel(
    mouse(up, 10),
    mouse(left, 10)
)

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

No branches or pull requests

2 participants