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

Add option to configure mouse bindings #5022

Merged
merged 2 commits into from
Jun 29, 2024
Merged

Add option to configure mouse bindings #5022

merged 2 commits into from
Jun 29, 2024

Conversation

rom1v
Copy link
Collaborator

@rom1v rom1v commented Jun 24, 2024

The argument must be exactly 4 characters, one for each secondary click:

--mouse-bind=xxxx
             ^^^^
             ||||
             ||| `- 5th click
             || `-- 4th click
             | `--- middle click
              `---- right click

Each character must be one of the following:

  • +: forward the click to the device
  • -: ignore the click
  • b: trigger shortcut BACK (or turn screen on if off)
  • h: trigger shortcut HOME
  • s: trigger shortcut APP_SWITCH
  • n: trigger shortcut "expand notification panel"

For example:

scrcpy --mouse-bind=bhsn  # the default mode
scrcpy --mouse-bind=++++  # forward all clicks
scrcpy --mouse-bind=++bh  # forward right and middle clicks,
                          # use 4th and 5th for BACK and HOME

This deprecates --forward-all-clicks (use --mouse-bind=++++ instead).

Refs #2258 (comment)


Also forward all clicks by default for UHID/AOA

By default, only the left click is forwarded to the device, and secondary clicks trigger shortcuts (the behavior can now be configured by --mouse-bind=xxxx).

But when the mouse mode is relative (AOA and UHID modes), forward all clicks by default. This makes more sense since the cursor is handled on the device side, the user expects all mouse buttons to be forwarded.

Refs #4727 (comment)

Supersedes #4877

rom1v added 2 commits June 24, 2024 23:17
Add a new option --mouse-bind=xxxx.

The argument must be exactly 4 characters, one for each secondary click:

    --mouse-bind=xxxx
                 ^^^^
                 ||||
                 ||| `- 5th click
                 || `-- 4th click
                 | `--- middle click
                  `---- right click

Each character must be one of the following:
 - `+`: forward the click to the device
 - `-`: ignore the click
 - `b`: trigger shortcut BACK (or turn screen on if off)
 - `h`: trigger shortcut HOME
 - `s`: trigger shortcut APP_SWITCH
 - `n`: trigger shortcut "expand notification panel"

This deprecates --forward-all-clicks (use --mouse-bind=++++ instead).

Refs <#2258 (comment)>
PR #5022 <#5022>
By default, only the left click is forwarded to the device, and
secondary clicks trigger shortcuts (the behavior can be configured by
--mouse-bind=xxxx).

But when the mouse mode is relative (AOA and UHID modes), forward all
clicks by default. This makes more sense since the cursor is handled on
the device side, the user expects all mouse buttons to be forwarded.

Refs <#4727 (comment)>
PR #5022 <#5022>
@rom1v rom1v changed the base branch from master to dev June 24, 2024 21:19
@rom1v
Copy link
Collaborator Author

rom1v commented Jun 24, 2024

I'm not sure about the second part (forwarding all clicks by default only for AOA and UHID), that might add confusion.

Maybe keeping the shortcuts bhsn for all secondary clicks by default whatever the mouse mode is better, what do you think?

@rom1v rom1v mentioned this pull request Jun 25, 2024
2 tasks
@123SONIC321
Copy link

@rom1v I've tested it, and I'm glad to report that everything worked as expected. I didn't encounter any issues. However, I do have one question: Once I've set the keybinds, do I need to set them again the next time I use the program, or does it remember them?

@rom1v
Copy link
Collaborator Author

rom1v commented Jun 25, 2024

I've tested it, and I'm glad to report that everything worked as expected. I didn't encounter any issues.

Thank you for the feedback 👍

Once I've set the keybinds, do I need to set them again the next time I use the program, or does it remember them?

Scrcpy does not remember anything, all configuration is passed via command line arguments.

But you can just add the arguments you want in a script: https://github.com/Genymobile/scrcpy/blob/master/doc/windows.md#run

@rom1v rom1v merged commit f5e6b80 into dev Jun 29, 2024
@rom1v
Copy link
Collaborator Author

rom1v commented Jun 29, 2024

🚀

FreedomBen pushed a commit to FreedomBen/scrcpy that referenced this pull request Aug 2, 2024
Add a new option --mouse-bind=xxxx.

The argument must be exactly 4 characters, one for each secondary click:

    --mouse-bind=xxxx
                 ^^^^
                 ||||
                 ||| `- 5th click
                 || `-- 4th click
                 | `--- middle click
                  `---- right click

Each character must be one of the following:
 - `+`: forward the click to the device
 - `-`: ignore the click
 - `b`: trigger shortcut BACK (or turn screen on if off)
 - `h`: trigger shortcut HOME
 - `s`: trigger shortcut APP_SWITCH
 - `n`: trigger shortcut "expand notification panel"

This deprecates --forward-all-clicks (use --mouse-bind=++++ instead).

Refs <Genymobile#2258 (comment)>
PR Genymobile#5022 <Genymobile#5022>
FreedomBen pushed a commit to FreedomBen/scrcpy that referenced this pull request Aug 2, 2024
By default, only the left click is forwarded to the device, and
secondary clicks trigger shortcuts (the behavior can be configured by
--mouse-bind=xxxx).

But when the mouse mode is relative (AOA and UHID modes), forward all
clicks by default. This makes more sense since the cursor is handled on
the device side, the user expects all mouse buttons to be forwarded.

Refs <Genymobile#4727 (comment)>
PR Genymobile#5022 <Genymobile#5022>
Gottox pushed a commit to Gottox/scrcpy that referenced this pull request Sep 29, 2024
Add a new option --mouse-bind=xxxx.

The argument must be exactly 4 characters, one for each secondary click:

    --mouse-bind=xxxx
                 ^^^^
                 ||||
                 ||| `- 5th click
                 || `-- 4th click
                 | `--- middle click
                  `---- right click

Each character must be one of the following:
 - `+`: forward the click to the device
 - `-`: ignore the click
 - `b`: trigger shortcut BACK (or turn screen on if off)
 - `h`: trigger shortcut HOME
 - `s`: trigger shortcut APP_SWITCH
 - `n`: trigger shortcut "expand notification panel"

This deprecates --forward-all-clicks (use --mouse-bind=++++ instead).

Refs <Genymobile#2258 (comment)>
PR Genymobile#5022 <Genymobile#5022>
Gottox pushed a commit to Gottox/scrcpy that referenced this pull request Sep 29, 2024
By default, only the left click is forwarded to the device, and
secondary clicks trigger shortcuts (the behavior can be configured by
--mouse-bind=xxxx).

But when the mouse mode is relative (AOA and UHID modes), forward all
clicks by default. This makes more sense since the cursor is handled on
the device side, the user expects all mouse buttons to be forwarded.

Refs <Genymobile#4727 (comment)>
PR Genymobile#5022 <Genymobile#5022>
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