You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Really great application!! Small, fast, simple, functional! Suggestion:
Would be possible to send some silent actions to the controlled mobile to assure the phone never get locked? Like "clicking" somewhere or send any non-action character to the phone.
Create a new keyboard shortcut to toggle it on/off, and commandline option for activate it on startup. Why:
Using "Stay awake" from Developer options is not viable, because that keeps phone lit even when its on charger as well (during night for ex.)
Phone (on its default user preferences) gets locked after 1min. or so and you have to manually unlock it every time.
Along with -S option, phone's physical screen will not wear off.
Reacted by skaiteo, Roberto Viola, Vedran Pavic, Rick, martin f. krafft, Daryl Liu, Phani Rithvij, Mattwmaster58, Peter Kingswell, bruteforks and 1 more
The "stay awake" option is available on most phones, through the System>developer tab. This keeps the phone from sleeping and locking. However, it is not a good option to keep active especially with AMOLED displays. A static screen image will burn in on the display. Checkout this link for details, stackoverflow
What would be ideal is if the Stay Awake option is toggled on only during a scrcpy session.
I use a bash script to achieve the above. Only issue is that the mobile phones should not be unplugged without disconnecting through the script.
Bash Script follows:
#!/usr/bin/env bash
scrcpy -S &
sleep 2
adb shell 'svc power stayon usb'
decision="n"while [ "$decision"!="y" ]
doecho"Disconnect? (y/n)"read -n 1 decision
if [ "$decision"=="y" ];then
adb shell 'svc power stayon false'echo"Disconnected on `date`"exit 0
fidone
Command to activate "Stay Awake" adb shell svc power stayon usb
Command to deactivate "Stay Awake" adb shell svc power stayon false
In order to support multiple phones add -s <SerialNo> to the scrcpy and adb commands. Note there needs to be a small delay between multiple scrcpy calls.
The problem with "stay awake" is that if the phone gets disconnected (because I pick it up for a call without thinking), then the option does not get turned off.
Would it be possible to schedule an event to run every couple of minutes, which turns off the stay-awake if scrcpy turned it on, and turn it on again, if scrcpy is still connected?
The problem with "stay awake" is that if the phone gets disconnected (because I pick it up for a call without thinking), then the option does not get turned off.
Would it be possible to schedule an event to run every couple of minutes, which turns off the stay-awake if scrcpy turned it on, and turn it on again, if scrcpy is still connected?
Yeah this happens to be a lot especially after writing the bash script to use stay awake. Thankfully after a bit of muscle memory i invariably disconnect through the script. Its not great but it works and protects the display.
Things are getting more interesting, when multiple devices are connected. Then even adb shell svc power stayon true does not work. Any idea, how to get awake state for multiple devices, while using Ubuntu 20.04 LTS and its based distros, where scrcpy v1.12 is available?
Edit: Thanks @rom1v for the clarification. I missed that if that information was presented in the details of the option, but my excuse is I was reading a ton about all the different options that are available. Cheers!
For what it's worth, on my Samsung Galaxy Tab S8 Ultra Wi-Fi model (SM-X900), scrcpy's still allowing the device to lock, at least with both the -S and -w options. This app "Caffeine - Keep Screen On" https://play.google.com/store/apps/details?id=moe.zhs.caffeine&hl=en_US&gl=US (I haven't tried the other similar one linked earlier) is working fine to still respect scrcpy's ability to keep the physical screen off while keeping the device unlocked and showing full-time in the remote session. I had to enable the "Caffeine - Keep Screen On" app's Compatibility Mode because the default mode didn't work, and you have to manually turn it on and off via Quick Setting tiles.
You can at least configure it to automatically turn off if you manually power the screen on or off. When used with scrcpy's --power-off-on-close option, that does count as an actual screen power event and turns "Caffeine - Keep Screen On" app off in conjunction with the app's option.
I also haven't looked into using Tasker (I am rooted) to automatically turn Caffeine on when / if it can detect when I'm remoted in using scrcpy.
Activity
srevinsaju commentedon Jul 1, 2019
Are you having 'caffeine' QS notification tile. I use that to keep the screen on with scrcpy?
rom1v commentedon Jul 1, 2019
A good solution would be to acquire a wake lock, but it does not work: #175 (comment)
rom1v commentedon Jul 1, 2019
Ref:
PowerManager.wakeUp()Ejsstiil commentedon Jul 2, 2019
Wow, thats awesome! It works great! It still require's an extra user action to turn it on after scrcpy connects though, but it solves "the need".
cagnulein commentedon Jul 15, 2019
link to caffeinate https://play.google.com/store/apps/details?id=xyz.omnicron.caffeinate
yamsu commentedon Jul 19, 2019
The "stay awake" option is available on most phones, through the System>developer tab. This keeps the phone from sleeping and locking. However, it is not a good option to keep active especially with AMOLED displays. A static screen image will burn in on the display. Checkout this link for details, stackoverflow
What would be ideal is if the Stay Awake option is toggled on only during a scrcpy session.
I use a bash script to achieve the above. Only issue is that the mobile phones should not be unplugged without disconnecting through the script.
Bash Script follows:
Command to activate "Stay Awake"
adb shell svc power stayon usbCommand to deactivate "Stay Awake"
adb shell svc power stayon falseIn order to support multiple phones add
-s <SerialNo>to the scrcpy and adb commands. Note there needs to be a small delay between multiple scrcpy calls.madduck commentedon Jan 7, 2020
The problem with "stay awake" is that if the phone gets disconnected (because I pick it up for a call without thinking), then the option does not get turned off.
Would it be possible to schedule an event to run every couple of minutes, which turns off the stay-awake if scrcpy turned it on, and turn it on again, if scrcpy is still connected?
amosbird commentedon Feb 25, 2020
stay awake is not perfect. I'd still like to turn off the screen but without locking it. Is it even possible?
yamsu commentedon Apr 1, 2020
Yeah this happens to be a lot especially after writing the bash script to use stay awake. Thankfully after a bit of muscle memory i invariably disconnect through the script. Its not great but it works and protects the display.
Add an option to keep the device awake
rom1v commentedon May 2, 2020
I just implemented it on
devbranch:c770243
The initial state is restored, even on device disconnection (I implemented 2f74ec2 just before).
edmundlaugasson commentedon Aug 9, 2021
Things are getting more interesting, when multiple devices are connected. Then even
adb shell svc power stayon truedoes not work. Any idea, how to get awake state for multiple devices, while using Ubuntu 20.04 LTS and its based distros, where scrcpy v1.12 is available?roirraWedorehT commentedon May 6, 2022
Edit: Thanks @rom1v for the clarification. I missed that if that information was presented in the details of the option, but my excuse is I was reading a ton about all the different options that are available. Cheers!
For what it's worth, on my Samsung Galaxy Tab S8 Ultra Wi-Fi model (SM-X900), scrcpy's still allowing the device to lock, at least with both the -S and -w options. This app "Caffeine - Keep Screen On" https://play.google.com/store/apps/details?id=moe.zhs.caffeine&hl=en_US&gl=US (I haven't tried the other similar one linked earlier) is working fine to still respect scrcpy's ability to keep the physical screen off while keeping the device unlocked and showing full-time in the remote session. I had to enable the "Caffeine - Keep Screen On" app's Compatibility Mode because the default mode didn't work, and you have to manually turn it on and off via Quick Setting tiles.
You can at least configure it to automatically turn off if you manually power the screen on or off. When used with scrcpy's
--power-off-on-closeoption, that does count as an actual screen power event and turns "Caffeine - Keep Screen On" app off in conjunction with the app's option.I also haven't looked into using Tasker (I am rooted) to automatically turn Caffeine on when / if it can detect when I'm remoted in using scrcpy.
rom1v commentedon May 6, 2022
The option is only effective over USB (that's a limitation of the Android settings stay_awake_while_plugged_in).
Kareem-Zaid commentedon Jul 6, 2024
#https://github.com/Genymobile/scrcpy/blob/master/doc/device.md#turn-screen-off