diff --git a/app/scrcpy.1 b/app/scrcpy.1 index d6940449..164c9b00 100644 --- a/app/scrcpy.1 +++ b/app/scrcpy.1 @@ -323,6 +323,7 @@ Each character must be one of the following: - 'h': trigger shortcut HOME - 's': trigger shortcut APP_SWITCH - 'n': trigger shortcut "expand notification panel" + - 'i': trigger shortcut INFO Default is 'bhsn:++++' for SDK mouse, and '++++:bhsn' for AOA and UHID. @@ -747,6 +748,10 @@ Click on VOLUME_DOWN .B MOD+p Click on POWER (turn screen on/off) +.TP +.B MOD+i +Click on INFO + .TP .B Right\-click (when screen is off) Turn screen on @@ -792,7 +797,7 @@ Inject computer clipboard text as a sequence of key events Open keyboard settings on the device (for HID keyboard only) .TP -.B MOD+i +.B MOD+q Enable/disable FPS counter (print frames/second in logs) .TP diff --git a/app/src/cli.c b/app/src/cli.c index b2e3e30a..bf31a98c 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -604,6 +604,7 @@ static const struct sc_option options[] = { " 'h': trigger shortcut HOME\n" " 's': trigger shortcut APP_SWITCH\n" " 'n': trigger shortcut \"expand notification panel\"\n" + " 'i': trigger shortcut INFO\n" "Default is 'bhsn:++++' for SDK mouse, and '++++:bhsn' for AOA " "and UHID.", }, @@ -785,7 +786,7 @@ static const struct sc_option options[] = { .longopt_id = OPT_PRINT_FPS, .longopt = "print-fps", .text = "Start FPS counter, to print framerate logs to the console. " - "It can be started or stopped at any time with MOD+i.", + "It can be started or stopped at any time with MOD+q.", }, { .longopt_id = OPT_PUSH_TARGET, @@ -1122,6 +1123,10 @@ static const struct sc_shortcut shortcuts[] = { .shortcuts = { "MOD+s", "4th-click" }, .text = "Click on APP_SWITCH", }, + { + .shortcuts = { "MOD+i" }, + .text = "Click on INFO", + }, { .shortcuts = { "MOD+m" }, .text = "Click on MENU", @@ -1184,7 +1189,7 @@ static const struct sc_shortcut shortcuts[] = { .text = "Open keyboard settings on the device (for HID keyboard only)", }, { - .shortcuts = { "MOD+i" }, + .shortcuts = { "MOD+q" }, .text = "Enable/disable FPS counter (print frames/second in logs)", }, { @@ -2297,6 +2302,9 @@ parse_mouse_binding(char c, enum sc_mouse_binding *b) { case 's': *b = SC_MOUSE_BINDING_APP_SWITCH; return true; + case 'i': + *b = SC_MOUSE_BINDING_INFO; + return true; case 'n': *b = SC_MOUSE_BINDING_EXPAND_NOTIFICATION_PANEL; return true; @@ -2333,7 +2341,7 @@ parse_mouse_bindings(const char *s, struct sc_mouse_bindings *mb) { // either "xxxx" or "xxxx:xxxx" if (len != 4 && (len != 9 || s[4] != ':')) { LOGE("Invalid mouse bindings: '%s' (expected 'xxxx' or 'xxxx:xxxx', " - "with each 'x' being in {'+', '-', 'b', 'h', 's', 'n'})", s); + "with each 'x' being in {'+', '-', 'b', 'h', 's', 'n', 'i'})", s); return false; } diff --git a/app/src/input_manager.c b/app/src/input_manager.c index 3e4dd0f3..83efd1fb 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -103,6 +103,11 @@ action_menu(struct sc_input_manager *im, enum sc_action action) { send_keycode(im, AKEYCODE_MENU, action, "MENU"); } +static inline void +action_info(struct sc_input_manager *im, enum sc_action action) { + send_keycode(im, AKEYCODE_INFO, action, "INFO"); +} + // turn the screen on if it was off, press BACK otherwise // If the screen is off, it is turned on only on ACTION_DOWN static void @@ -428,6 +433,11 @@ sc_input_manager_process_key(struct sc_input_manager *im, action_power(im, action); } return; + case SDLK_i: + if (im->kp && !shift && !repeat && !paused) { + action_info(im, action); + } + return; case SDLK_o: if (control && !repeat && down && !paused) { bool on = shift; @@ -520,7 +530,7 @@ sc_input_manager_process_key(struct sc_input_manager *im, sc_screen_resize_to_pixel_perfect(im->screen); } return; - case SDLK_i: + case SDLK_q: if (video && !shift && !repeat && down) { switch_fps_counter_state(im); } @@ -776,6 +786,11 @@ sc_input_manager_process_mouse_button(struct sc_input_manager *im, } } return; + case SC_MOUSE_BINDING_INFO: + if (im->kp) { + action_info(im, action); + } + return; default: assert(binding == SC_MOUSE_BINDING_CLICK); break; diff --git a/app/src/options.h b/app/src/options.h index 03b42913..5f24d414 100644 --- a/app/src/options.h +++ b/app/src/options.h @@ -183,6 +183,7 @@ enum sc_mouse_binding { SC_MOUSE_BINDING_HOME, SC_MOUSE_BINDING_APP_SWITCH, SC_MOUSE_BINDING_EXPAND_NOTIFICATION_PANEL, + SC_MOUSE_BINDING_INFO, }; struct sc_mouse_binding_set { diff --git a/doc/mouse.md b/doc/mouse.md index 0bea4aea..b2e3ed5a 100644 --- a/doc/mouse.md +++ b/doc/mouse.md @@ -125,6 +125,7 @@ Each character must be one of the following: - `h`: trigger shortcut `HOME` - `s`: trigger shortcut `APP_SWITCH` - `n`: trigger shortcut "expand notification panel" + - `i`: trigger shortcut `INFO` For example: diff --git a/doc/shortcuts.md b/doc/shortcuts.md index d22eb473..f6cd3de5 100644 --- a/doc/shortcuts.md +++ b/doc/shortcuts.md @@ -40,6 +40,7 @@ _[Super] is typically the Windows or Cmd key._ | Click on `VOLUME_UP` | MOD+ _(up)_ | Click on `VOLUME_DOWN` | MOD+ _(down)_ | Click on `POWER` | MOD+p + | Click on `INFO` | MOD+i | Power on | _Right-click²_ | Turn device screen off (keep mirroring) | MOD+o | Turn device screen on | MOD+Shift+o @@ -52,7 +53,7 @@ _[Super] is typically the Windows or Cmd key._ | Synchronize clipboards and paste⁵ | MOD+v | Inject computer clipboard text | MOD+Shift+v | Open keyboard settings (HID keyboard only) | MOD+k - | Enable/disable FPS counter (on stdout) | MOD+i + | Enable/disable FPS counter (on stdout) | MOD+q | Pinch-to-zoom/rotate | Ctrl+_click-and-move_ | Tilt vertically (slide with 2 fingers) | Shift+_click-and-move_ | Tilt horizontally (slide with 2 fingers) | Ctrl+Shift+_click-and-move_