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

Add screen off timeout configuration #5447

Merged
merged 2 commits into from
Nov 9, 2024
Merged

Add screen off timeout configuration #5447

merged 2 commits into from
Nov 9, 2024

Conversation

rom1v
Copy link
Collaborator

@rom1v rom1v commented Nov 3, 2024

The Android screen automatically turns off after some delay.

To change this delay while scrcpy is running:

scrcpy --screen-off-timeout=300  # 300 seconds (5 minutes)

The initial value is restored on exit.

This may be useful as an alternative to --stay-awake (which only works while the device is plugged in).

All options were configured dynamically by sending a single byte to an
output stream. But in practice, only the power mode must be changed
dynamically, the others are configured once on start.

For simplicity, pass the value of static options as command line
arguments, and handle dynamic options in a loop only from a separate
thread once the clean up process is started.

This will allow to easily add cleanup options with values which do not
fit in 1 byte.

Also handle the clean up thread (and the loading of initial settings
values) from the CleanUp class, to expose a simpler clean up API.

Refs 9efa162
Change the Android "screen off timeout" (the idle delay before the
screen automatically turns off) and restore the initial value on
exit.
@rom1v rom1v merged commit 36fe49e into dev Nov 9, 2024
rom1v added a commit that referenced this pull request Nov 9, 2024
All options were configured dynamically by sending a single byte to an
output stream. But in practice, only the power mode must be changed
dynamically, the others are configured once on start.

For simplicity, pass the value of static options as command line
arguments, and handle dynamic options in a loop only from a separate
thread once the clean up process is started.

This will allow to easily add cleanup options with values which do not
fit in 1 byte.

Also handle the clean up thread (and the loading of initial settings
values) from the CleanUp class, to expose a simpler clean up API.

Refs 9efa162
PR #5447 <#5447>
rom1v added a commit that referenced this pull request Nov 9, 2024
Change the Android "screen off timeout" (the idle delay before the
screen automatically turns off) and restore the initial value on
exit.

PR #5447 <#5447>
@rom1v
Copy link
Collaborator Author

rom1v commented Nov 9, 2024

(force pushed d3db9c4 and eff5b4b immediately after the merge to add a reference to the PR in the commit messages)

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

Successfully merging this pull request may close these issues.

1 participant