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

Force desktop mode Android 10 #1413

Open
KanielOut1s opened this issue May 20, 2020 · 43 comments
Open

Force desktop mode Android 10 #1413

KanielOut1s opened this issue May 20, 2020 · 43 comments

Comments

@KanielOut1s
Copy link

Hello, suggestion to make force desktop mode work on scrcpy? Would be a great feature.

@rom1v
Copy link
Collaborator

rom1v commented May 20, 2020

You mean "DeX" or something like that? #397 (comment)

@KanielOut1s
Copy link
Author

Dex is only for samsung. I'm using oneplus where dex is not available. But theres a feature of Android 10 called "Forced desktop mode" from developers option. Is it possible to make it work in scrcpy? I tried the solution from dex request but unfortunately it doesn't work.

@rom1v
Copy link
Collaborator

rom1v commented May 20, 2020

Oh, indeed, I have this option on my OnePlus 7 Pro. I don't know how it works though (what happens once it's enabled?).

@KanielOut1s
Copy link
Author

Using scrcpy, it only mirrors the phone screen.

@KanielOut1s
Copy link
Author

images

It should look like this. Left side u can add app shortcut to desktop. Right side opens the app installed in your phone.

@rom1v
Copy link
Collaborator

rom1v commented May 21, 2020

Using scrcpy, it only mirrors the phone screen.

That's expected before Android 10: https://github.com/Genymobile/scrcpy/blob/master/README.md#display

But it should work on Android 10 :/

Any message in the console?

@ColinHeathman
Copy link

The secondary display that would show desktop mode isn't online, so scrcpy can't connect to it

[server] ERROR: Exception on thread Thread[main,5,main]
com.genymobile.scrcpy.InvalidDisplayIdException: There is no display having id 1
        at com.genymobile.scrcpy.Device.<init>(Device.java:46)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:20)
        at com.genymobile.scrcpy.Server.main(Server.java:177)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:362)
[server] ERROR: Try to use one of the available display ids:
[server] ERROR:     scrcpy --display 0

@KanielOut1s
Copy link
Author

KanielOut1s commented May 27, 2020

So, u mean there is no work around for this? Anyway, thanks for your help.

@vmorghulis5887
Copy link

I kind of found a workaround. I'm using a pixel3 xl.

Using this app called SecondScreen you can force the screen of the device to change - https://play.google.com/store/apps/details?id=com.farmerbb.secondscreen.free&hl=en_US

A couple of notes on this:

  1. By default it forces the screen orientation to landscape. This might be fine but it does not seem to go away until reboot. I'm using 'Use System Settings' and letting scrcpy control this.
  2. Launch scrcpy after you've changed the screen setting of the app for scrcpy to show the screen in the right size.
  3. I'm still playing with the sizing but you can have a much bigger screen with this desktop mode or not. If you want desktop mode you just need to load the launcher that supports it. Taskbar for example and I'm sure there are others.

@i39MT
Copy link

i39MT commented Jun 7, 2020

I am using scrcpy with 4 monitors other than my phone's screen. I do that by simply simulating virtually secondary displays using the global setting overlay_display_devices which used in developer settings "Simulate Secondary Displays". I can simulate up to 4 3840x2160 displays by this command
adb shell settings put global overlay_display_devices 3840x2160/480\;3840x2160/480\;3840x2160/480\;3840x2160/480

and then run this command to find each display's id so I can mirror it by --display ID (every time I change the overlay_display_devices value it gives the displays new ids)
adb shell dumpsys display | findstr /r /c:"Display [0-9][0-9]*"

my problem is that with the simulated displays my phone screen gets crammed with semi-transparent displays. I wish if scrcpy can trick the phone that it is connected to some sort of external display or at least simulate non-visible screens that don't pop up on the main (phone) screen.

I enabled force desktop mode with the new taskbar 6.0 to give the external displays a taskbar and SecondaryDisplays to quickly test dpi and hide nav bar or android 10 gestures bill.

Screenshot (2)

@rom1v
Copy link
Collaborator

rom1v commented Jun 7, 2020

@i39MT Thank you for the trick.

However, on my OnePlus 7 Pro, if a add a simulated secondary display, mirroring it displays a blank screen.

@i39MT
Copy link

i39MT commented Jun 7, 2020

@i39MT Thank you for the trick.

However, on my OnePlus 7 Pro, if a add a simulated secondary display, mirroring it displays a blank screen.

Have you enabled "Enable freeform windows" and "Force activities to be resizable" in dev settings?

@lerg96
Copy link

lerg96 commented Jun 14, 2020

@i39MT Thank you for the trick.
However, on my OnePlus 7 Pro, if a add a simulated secondary display, mirroring it displays a blank screen.

Have you enabled "Enable freeform windows" and "Force activities to be resizable" in dev settings?

I have the same problem, both enables ("Enable freeform windows" and "Force activities to be resizable") it displays a blank screen only.. (Redmi note 7 - MIUI 12 - Android 10 [EU rom])
EDIT: When the device is locked i can see a desktop lock screen, when unlocked goes black again

scrcpy_fpsxpYXBsA
scrcpy_kiJyJCdgWj

@i39MT
Copy link

i39MT commented Jun 14, 2020

@i39MT Thank you for the trick.
However, on my OnePlus 7 Pro, if a add a simulated secondary display, mirroring it displays a blank screen.

Have you enabled "Enable freeform windows" and "Force activities to be resizable" in dev settings?

I have the same problem, both enables ("Enable freeform windows" and "Force activities to be resizable") it displays a blank screen only.. (Redmi note 7 - MIUI 12 - Android 10 [EU rom])
EDIT: When the device is locked i can see a desktop lock screen, when unlocked goes black again

scrcpy_fpsxpYXBsA
scrcpy_kiJyJCdgWj

I got the same lockscreen when I lock my phone.
The black screen might be because the default launcher, change it to something like nova launcher or taskbar v6.0.

@lerg96
Copy link

lerg96 commented Jun 14, 2020

@i39MT Thank you for the trick.
However, on my OnePlus 7 Pro, if a add a simulated secondary display, mirroring it displays a blank screen.

Have you enabled "Enable freeform windows" and "Force activities to be resizable" in dev settings?

I have the same problem, both enables ("Enable freeform windows" and "Force activities to be resizable") it displays a blank screen only.. (Redmi note 7 - MIUI 12 - Android 10 [EU rom])
EDIT: When the device is locked i can see a desktop lock screen, when unlocked goes black again
scrcpy_fpsxpYXBsA
scrcpy_kiJyJCdgWj

I got the same lockscreen when I lock my phone.
The black screen might be because the default launcher, change it to something like nova launcher or taskbar v6.0.

right now i am using nova launcher, will try with taskbar 6.0

@leokwu
Copy link

leokwu commented Aug 11, 2020

Where in the Android 10 source code do I configure default open to force desktop mode?

@AfroUSApl
Copy link

Hi,
How do you remove app icon, added on desktop from "Add app shortcut" ??
It seems to there is no way to remove any added shortcut...

@i39MT
Copy link

i39MT commented Oct 2, 2020

Im not sure actually im using taskbar as my home app so it can assign a specific launcher to ur phones screen while managing the additional display with a much more optimized interface.

@Mksuthar-de
Copy link

Im not sure actually im using taskbar as my home app so it can assign a specific launcher to ur phones screen while managing the additional display with a much more optimized inter

I am using scrcpy with 4 monitors other than my phone's screen. I do that by simply simulating virtually secondary displays using the global setting overlay_display_devices which used in developer settings "Simulate Secondary Displays". I can simulate up to 4 3840x2160 displays by this command
adb shell settings put global overlay_display_devices 3840x2160/480\;3840x2160/480\;3840x2160/480\;3840x2160/480

and then run this command to find each display's id so I can mirror it by --display ID (every time I change the overlay_display_devices value it gives the displays new ids)
adb shell dumpsys display | findstr /r /c:"Display [0-9][0-9]*"

my problem is that with the simulated displays my phone screen gets crammed with semi-transparent displays. I wish if scrcpy can trick the phone that it is connected to some sort of external display or at least simulate non-visible screens that don't pop up on the main (phone) screen.

I enabled force desktop mode with the new taskbar 6.0 to give the external displays a taskbar and SecondaryDisplays to quickly test dpi and hide nav bar or android 10 gestures bill.

Screenshot (2)

would you help me sir,
i have compeleted all your steps
when i reached to display's id
i types the display id's like --Display 0
and press enter the command doesn't recognised.
sir please help i want use my pc as secondary diplay as android dex in android 10

@i39MT
Copy link

i39MT commented Dec 1, 2020 via email

@Mksuthar-de
Copy link

what do you got when you type: adb shell dumpsys display | findstr /r /c:"Display [0-9][0-9]"

On Tue, Dec 1, 2020, 14:27 Mksuthar-de @.
*> wrote: Im not sure actually im using taskbar as my home app so it can assign a specific launcher to ur phones screen while managing the additional display with a much more optimized inter I am using scrcpy with 4 monitors other than my phone's screen. I do that by simply simulating virtually secondary displays using the global setting overlay_display_devices which used in developer settings "Simulate Secondary Displays". I can simulate up to 4 3840x2160 displays by this command adb shell settings put global overlay_display_devices 3840x2160/480;3840x2160/480;3840x2160/480;3840x2160/480 and then run this command to find each display's id so I can mirror it by --display ID (every time I change the overlay_display_devices value it gives the displays new ids) adb shell dumpsys display | findstr /r /c:"Display [0-9][0-9]" my problem is that with the simulated displays my phone screen gets crammed with semi-transparent displays. I wish if scrcpy can trick the phone that it is connected to some sort of external display or at least simulate non-visible screens that don't pop up on the main (phone) screen. I enabled force desktop mode with the new taskbar 6.0 to give the external displays a taskbar and SecondaryDisplays to quickly test dpi and hide nav bar or android 10 gestures bill. [image: Screenshot (2)] https://user-images.githubusercontent.com/66570391/83979084-6a889f00-a914-11ea-83ec-13ad0b2b96b6.png would you help me sir, i have compeleted all your steps when i reached to display's id i types the display id's like --Display 0 and press enter the command doesn't recognised. sir please help i want use my pc as secondary diplay as android dex in android 10 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1413 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP34RF6JUE4UNKKUHEI3RB3SSTHJNANCNFSM4NGF2DYA .

i got
Display 0 :
Display 11:

@rom1v
Copy link
Collaborator

rom1v commented Dec 1, 2020

Then:

scrcpy --display 0
scrcpy --display 11

@Mksuthar-de
Copy link

Then:

scrcpy --display 0
scrcpy --display 11

i typed this says
scrcpy : unknown option --display

@Mksuthar-de
Copy link

what do you got when you type: adb shell dumpsys display | findstr /r /c:"Display [0-9][0-9]"

On Tue, Dec 1, 2020, 14:27 Mksuthar-de @.
*> wrote: Im not sure actually im using taskbar as my home app so it can assign a specific launcher to ur phones screen while managing the additional display with a much more optimized inter I am using scrcpy with 4 monitors other than my phone's screen. I do that by simply simulating virtually secondary displays using the global setting overlay_display_devices which used in developer settings "Simulate Secondary Displays". I can simulate up to 4 3840x2160 displays by this command adb shell settings put global overlay_display_devices 3840x2160/480;3840x2160/480;3840x2160/480;3840x2160/480 and then run this command to find each display's id so I can mirror it by --display ID (every time I change the overlay_display_devices value it gives the displays new ids) adb shell dumpsys display | findstr /r /c:"Display [0-9][0-9]" my problem is that with the simulated displays my phone screen gets crammed with semi-transparent displays. I wish if scrcpy can trick the phone that it is connected to some sort of external display or at least simulate non-visible screens that don't pop up on the main (phone) screen. I enabled force desktop mode with the new taskbar 6.0 to give the external displays a taskbar and SecondaryDisplays to quickly test dpi and hide nav bar or android 10 gestures bill. [image: Screenshot (2)] https://user-images.githubusercontent.com/66570391/83979084-6a889f00-a914-11ea-83ec-13ad0b2b96b6.png would you help me sir, i have compeleted all your steps when i reached to display's id i types the display id's like --Display 0 and press enter the command doesn't recognised. sir please help i want use my pc as secondary diplay as android dex in android 10 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1413 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP34RF6JUE4UNKKUHEI3RB3SSTHJNANCNFSM4NGF2DYA .

i got
Display 0 :
Display 11:

sir do you have youtube channel ?
i will be very helpful you give me a tutorial of
each step

@Mksuthar-de
Copy link

what do you got when you type: adb shell dumpsys display | findstr /r /c:"Display [0-9][0-9]"

On Tue, Dec 1, 2020, 14:27 Mksuthar-de @.
*> wrote: Im not sure actually im using taskbar as my home app so it can assign a specific launcher to ur phones screen while managing the additional display with a much more optimized inter I am using scrcpy with 4 monitors other than my phone's screen. I do that by simply simulating virtually secondary displays using the global setting overlay_display_devices which used in developer settings "Simulate Secondary Displays". I can simulate up to 4 3840x2160 displays by this command adb shell settings put global overlay_display_devices 3840x2160/480;3840x2160/480;3840x2160/480;3840x2160/480 and then run this command to find each display's id so I can mirror it by --display ID (every time I change the overlay_display_devices value it gives the displays new ids) adb shell dumpsys display | findstr /r /c:"Display [0-9][0-9]" my problem is that with the simulated displays my phone screen gets crammed with semi-transparent displays. I wish if scrcpy can trick the phone that it is connected to some sort of external display or at least simulate non-visible screens that don't pop up on the main (phone) screen. I enabled force desktop mode with the new taskbar 6.0 to give the external displays a taskbar and SecondaryDisplays to quickly test dpi and hide nav bar or android 10 gestures bill. [image: Screenshot (2)] https://user-images.githubusercontent.com/66570391/83979084-6a889f00-a914-11ea-83ec-13ad0b2b96b6.png would you help me sir, i have compeleted all your steps when i reached to display's id i types the display id's like --Display 0 and press enter the command doesn't recognised. sir please help i want use my pc as secondary diplay as android dex in android 10 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1413 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP34RF6JUE4UNKKUHEI3RB3SSTHJNANCNFSM4NGF2DYA .

sir do you have youtube channel ?
i will be very helpful you give me a tutorial of
each step

@rom1v
Copy link
Collaborator

rom1v commented Dec 1, 2020

scrcpy : unknown option --display

Then use the latest version.

@Mksuthar-de
Copy link

scrcpy : unknown option --display

Then use the latest version.

i am using latest version
btw would you suggest me any tutorial video.
plzzz

@rom1v
Copy link
Collaborator

rom1v commented Dec 1, 2020

What is the result of scrcpy --version?

@Mksuthar-de
Copy link

dependencies:

  • SDL 2.0.12
  • libavcodec 58.91.100
  • libavformat 58.45.100
  • libavutil 56.51.100

@rom1v
Copy link
Collaborator

rom1v commented Dec 1, 2020

You missed the first line, where the scrcpy version is printed (above "dependencies") 😄

@Mksuthar-de
Copy link

scrcpy 1.16
sorry

@rom1v
Copy link
Collaborator

rom1v commented Dec 1, 2020

scrcpy 1.16

i typed this says
scrcpy : unknown option --display

That's not possible.

Please copy the exact command you typed, and copy-paste the exact error message (spaces included, and with the exact case).

@Mksuthar-de
Copy link

Mksuthar-de commented Dec 1, 2020 via email

@Mksuthar-de
Copy link

Mksuthar-de commented Dec 1, 2020 via email

@sandriaas
Copy link

@i39MT hi btw how i can disable "Simulate Secondary Displays" via adb? or remove the put global overlay command? thanks before

@i39MT
Copy link

i39MT commented Dec 5, 2020

@i39MT hi btw how i can disable "Simulate Secondary Displays" via adb? or remove the put global overlay command? thanks before

you can delete the field by typing this
adb shell settings delete global overlay_display_devices

and I don't think deleting it would affect anything in the phone

@sandriaas
Copy link

@i39MT hi btw how i can disable "Simulate Secondary Displays" via adb? or remove the put global overlay command? thanks before

you can delete the field by typing this
adb shell settings delete global overlay_display_devices

and I don't think deleting it would affect anything in the phone

Thank you!!

@iHad169
Copy link

iHad169 commented Feb 10, 2021

Sorry, I watch Your discussion.
I don't know how to use scrcpy run Desktop Mode.
Can you list the Step?
Thank you

@yashoswalyo
Copy link

yashoswalyo commented Sep 22, 2021

adb shell settings put global overlay_display_devices 3840x2160/480

When I run this the scondary display overlays on my main screen, is this expected behaviour or it should run in background?

@matthiasneuner
Copy link

adb shell settings put global overlay_display_devices 3840x2160/480

When I run this the scondary display overlays on my main screen, is this expected behaviour or it should run in background?

Same for me on my Huawei Matepad 11; However I am able to pinch it very small with two fingers .. Not an ideal solution though.

@bibaodi
Copy link

bibaodi commented Apr 19, 2023

I got a blank screen when using non '0' in --display.


eton@acr10d:~$ scrcpy -b24M  -S -w --display $VirtualExternalDisplay --encoder OMX.qcom.video.encoder.avc
INFO: scrcpy 1.17 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed. 1.9 MB/s (34015 bytes in 0.017s)
[server] INFO: Device: samsung SM-N9500 (Android 9)
[server] WARN: Display doesn't have FLAG_SUPPORTS_PROTECTED_BUFFERS flag, mirroring can be restricted
[server] WARN: Input events are not supported for secondary displays before Android 10
[server] ERROR: Exception on thread Thread[Thread-1,5,main]
java.lang.AssertionError: Could not inject input event if !supportsInputEvents()
	at com.genymobile.scrcpy.Device.injectEvent(Device.java:162)
	at com.genymobile.scrcpy.Device.injectEvent(Device.java:173)
	at com.genymobile.scrcpy.Device.injectKeyEvent(Device.java:180)
	at com.genymobile.scrcpy.Device.injectKeycode(Device.java:184)
	at com.genymobile.scrcpy.Controller.control(Controller.java:58)
	at com.genymobile.scrcpy.Server$2.run(Server.java:100)
	at java.lang.Thread.run(Thread.java:764)

@rom1v
Copy link
Collaborator

rom1v commented Apr 19, 2023

@bibaodi Your device runs Android 9 (<10).

@bibaodi
Copy link

bibaodi commented Apr 19, 2023

@bibaodi Your device runs Android 9 (<10).

very sorry. I should notice it.

Thanks @rom1v .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests