Scrcpy: Add shortcut to rotate screen

Created on 9 Mar 2018  路  13Comments  路  Source: Genymobile/scrcpy

When I go back to home screen the phone goes back to portrait mode and then after starting an app I have to manually lean the phone to rotate the screen, it would be easier if there was a shorcut which rotates the screen.

feature request rotation

Most helpful comment

As a workaround:

# disable auto rotation
adb shell settings put system accelerometer_rotation 0
# use custom rotation (0=portrait, 1=landscape)
adb shell settings put system user_rotation 1

https://github.com/Genymobile/scrcpy/issues/284#issuecomment-426269845

All 13 comments

Reference #218

As a workaround:

# disable auto rotation
adb shell settings put system accelerometer_rotation 0
# use custom rotation (0=portrait, 1=landscape)
adb shell settings put system user_rotation 1

https://github.com/Genymobile/scrcpy/issues/284#issuecomment-426269845

Is there a way to put the monitor in landscape while the camera is showing?
I tried the above commands both while scrcpy was active in terminal, and when it was not, and nothing happened when I executed the commands.

Am I missing something, or is the monitor simply not willing to be in landscape while the camera app is open?

Some camera apps keep the device in landscape mode (and rotate their icons manually when the device is rotated). This avoids a glitch due to the portrait/landscape switch.

The "solution" is to implement a (manual) client-side rotation in scrcpy.

Aha, that makes sense! Thanks for the fast response!

Is there a simple way of implementing this, or is this something I should just leave be?
I'm just wondering if it is possible to rotate the mirror shown on my desktop some way.

I have absolutely no experience with this though.

It is probably not very difficult, but it is quite intrusive (we need to check everywhere the current rotation to reverse width and height).

It's in my (virtual) todo list when I have time (maybe after the "device screen off" while mirroring).

Alright! Thanks!

In the meantime I'll just use another app that rotates with the screen.
Open Camera worked really well, for other users having the same issue.

Thanks again!

This would be great to be implemented in next release.

Appart from this it has everything needed to work daily with it.

This is implemented in guiscrcpy. In Python , it is easy to implement, and I use it frequently

i added shortcut key for screen rotation
here's the code:
https://files.catbox.moe/c8lz87.c
Place input_manager.c inside project-> app--src folder and build it using
ninja -Cx
./run x

Ctrl+q = Change screen density to 200
Ctrl+w = Reset screen density
Ctrl+e = landscape mode
Ctrl+r = portrait mode

try this first in adb if rotation doesnt work
adb shell settings put system accelerometer_rotation 0

I just implemented it on branch rotatedevice (eb0f339271862af38693913e5ce1d4078d2c9e56).

Just press Ctrl+r (or Cmd+r on macOS) to rotate the device.

Feedbacks welcome :)

Tested on Pixel 2 and Pixel 4 - Android 10, from macOS Catalina.
Works perfectly! Thanks

Merged in dev.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

qymspace picture qymspace  路  3Comments

udit7395 picture udit7395  路  4Comments

singleNeuron picture singleNeuron  路  3Comments

tonypachino picture tonypachino  路  3Comments

sennight picture sennight  路  3Comments