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

ScrCpy Should Support Android Shortcut Keys #1881

Closed
1 task done
xcjs opened this issue Nov 3, 2020 · 3 comments
Closed
1 task done

ScrCpy Should Support Android Shortcut Keys #1881

xcjs opened this issue Nov 3, 2020 · 3 comments

Comments

@xcjs
Copy link

xcjs commented Nov 3, 2020

There are requests for custom keymaps, but I feel that these mappings should just work.

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I'm frustrated that keys on my keyboard don't map to Android the same way that bluetooth keyboards do.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Certain keys on Android trigger specific actions:

Home: Navigates to the default configured Android launcher
Esc: Equivalent to the Back button
Media keys: My keyboard has a dedicated set of volume keys (up, down, and mute) that typically work on Android keyboards. Some keyboards also have dedicated key codes for play/pause, skip, and previous track that should also work in Android. It would be nice if these work as expected.

I would like these key codes to work as they normally would if passed forward to an Android device.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

The alternative is not having the feature as I don't see any other way to get this to work.

Additional context
Add any other context or screenshots about the feature request here.

@rom1v
Copy link
Collaborator

rom1v commented Nov 3, 2020

Home: Navigates to the default configured Android launcher

Home is now bound to MOVE_HOME to be consistent with MOVE_END: 5d473ef (#555).

MOD+h or middle-click pressed HOME.

Esc: Equivalent to the Back button

Esc injects ESCAPE (like adb shell input keyevent ESCAPE). It often has the same effect as BACK, but not always.

Media keys: My keyboard has a dedicated set of volume keys (up, down, and mute) that typically work on Android keyboards. Some keyboards also have dedicated key codes for play/pause, skip, and previous track that should also work in Android. It would be nice if these work as expected.

Refs #1824

If you want to work on it, please add the mapping here (on dev branch):

switch (from) {
MAP(SDLK_RETURN, AKEYCODE_ENTER);
MAP(SDLK_KP_ENTER, AKEYCODE_NUMPAD_ENTER);
MAP(SDLK_ESCAPE, AKEYCODE_ESCAPE);
MAP(SDLK_BACKSPACE, AKEYCODE_DEL);
MAP(SDLK_TAB, AKEYCODE_TAB);
MAP(SDLK_PAGEUP, AKEYCODE_PAGE_UP);
MAP(SDLK_DELETE, AKEYCODE_FORWARD_DEL);
MAP(SDLK_HOME, AKEYCODE_MOVE_HOME);
MAP(SDLK_END, AKEYCODE_MOVE_END);
MAP(SDLK_PAGEDOWN, AKEYCODE_PAGE_DOWN);
MAP(SDLK_RIGHT, AKEYCODE_DPAD_RIGHT);
MAP(SDLK_LEFT, AKEYCODE_DPAD_LEFT);
MAP(SDLK_DOWN, AKEYCODE_DPAD_DOWN);
MAP(SDLK_UP, AKEYCODE_DPAD_UP);
MAP(SDLK_LCTRL, AKEYCODE_CTRL_LEFT);
MAP(SDLK_RCTRL, AKEYCODE_CTRL_RIGHT);
MAP(SDLK_LSHIFT, AKEYCODE_SHIFT_LEFT);
MAP(SDLK_RSHIFT, AKEYCODE_SHIFT_RIGHT);
}

@guanzhangrtk
Copy link

guanzhangrtk commented Nov 7, 2020

[Edit: Actually on the Mac seems the MOD button is alt/option instead of command, so it is actually working as intended]

Do these shortcut keys work on the Mac? Command-H seems to be able to bring you back to HOME however these shortcut keys seems to conflict with Mac internal shortcut keys (for instance command-H is hide program).

Thanks!

@rom1v
Copy link
Collaborator

rom1v commented Nov 7, 2020

Actually on the Mac seems the MOD button is alt/option instead of command, so it is actually working as intended

Both Alt/Super trigger shortcuts, unless the system capture them before transmitting the key to scrcpy.

https://github.com/Genymobile/scrcpy#shortcuts

@rom1v rom1v closed this as completed Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants