Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
110.68k stars 10.61k forks source link

Switch between navigation bar and swipe control by command line arguments #2421

Open tatteredprince opened 3 years ago

tatteredprince commented 3 years ago

Hello,

I propose to add command line arguments --navigation-bar and --swipe-control which will turn on appropriate controls for a session.

As --show-touches works which I use.

I often miss-click right mouse button and some applications are redrawn upon minimize, and theirs contexts are lost.

It's good that we have MOD+b for back and MOD+h for home, but it would be nicer to have those switches.

rom1v commented 3 years ago

I propose to add command line arguments --navigation-bar and --swipe-control which will turn on appropriate controls for a session.

Which concrete actions would they do?

AFAIK, there is no easy way to just enable/disable the navigation bar (from adb for example).

What would --swipe-control do?

I often miss-click right mouse button

There is an option --forward-all-clicks (so that you inject right-click instead of BACK).

tatteredprince commented 3 years ago

--navigation-bar will force switching to navigation bar with three classical buttons: back, home and application cycle.

--swipe-control will force switching to gesture control. With --forward-all-clicks it will work like charm.

I started using --forward-all-clicks after many days of miss-clicking.

I use gesture control and think that navigation bar --forward-all-clicks will fit perfectly.

But I don't wanna use it forever, my fingers are very good for swipes.

How hard it was to --show-touches? It seems that two proposed command are in the same league.

tatteredprince commented 3 years ago

I switched to navigation bar on my phone and executed:

adb shell cmd overlay enable com.android.internal.systemui.navbar.gestural

That switched on gesture navigation.

rom1v commented 3 years ago

:+1: (for recent Android only I guess)

cmd source code is here: https://android.googlesource.com/platform/frameworks/native/+/refs/heads/master/cmds/cmd/cmd.cpp

In the end, it calls this code in Java:

https://github.com/aosp-mirror/platform_frameworks_base/blob/f9eb7b947a88b905a1cd4bb3e0b22582cae26055/services/core/java/com/android/server/om/OverlayManagerShellCommand.java#L65-L68

But all of this is just the wrapper. Instead, we should call the method expose in the AIDL of the service IOverlayManager:

https://github.com/aosp-mirror/platform_frameworks_base/blob/f9eb7b947a88b905a1cd4bb3e0b22582cae26055/core/java/android/content/om/IOverlayManager.aidl#L91

hacker1024 commented 2 years ago

Is there any progress on this yet? If not, would you be open to a PR?