Skip to content

Display and control your Android device

Replace Ctrl by Meta for volume shortcuts on MacOS

Romain Vimontd061c309656b
diff --git a/README.md b/README.md
index 28e76e24..661bf5e6 100644
--- a/README.md
+++ b/README.md
@@ -134,8 +134,8 @@ scrcpy -f
| click on `BACK` | `Ctrl`+`b` \| _Right-click²_ |
| click on `APP_SWITCH` | `Ctrl`+`s` |
| click on `MENU` | `Ctrl`+`m` |
- | click on `VOLUME_UP` | `Ctrl`+`↑` _(up)_ |
- | click on `VOLUME_DOWN` | `Ctrl`+`↓` _(down)_ |
+ | click on `VOLUME_UP` | `Ctrl`+`↑` _(up)_ (`Cmd`+`↑` on MacOS) |
+ | click on `VOLUME_DOWN` | `Ctrl`+`↓` _(down)_ (`Cmd`+`↓` on MacOS) |
| click on `POWER` | `Ctrl`+`p` |
| turn screen on | _Right-click²_ |
| paste computer clipboard to device | `Ctrl`+`v` |
diff --git a/app/src/input_manager.c b/app/src/input_manager.c
index b6a2b650..21b7c407 100644
--- a/app/src/input_manager.c
+++ b/app/src/input_manager.c
@@ -200,13 +200,21 @@ void input_manager_process_key(struct input_manager *input_manager,
}
return;
case SDLK_DOWN:
+#ifdef __APPLE__
+ if (!ctrl && meta) {
+#else
if (ctrl && !meta) {
+#endif
// forward repeated events
action_volume_down(input_manager->controller, action);
}
return;
case SDLK_UP:
+#ifdef __APPLE__
+ if (!ctrl && meta) {
+#else
if (ctrl && !meta) {
+#endif
// forward repeated events
action_volume_up(input_manager->controller, action);
}