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

When the screen is off, if the screen turns on from a command in the PC, order it to turn back off #1573

Closed
brunoais opened this issue Jul 7, 2020 · 5 comments

Comments

@brunoais
Copy link
Contributor

brunoais commented Jul 7, 2020

Is your feature request related to a problem? Please describe.
Sometimes I get distracted by my phone when the screen turns back on and I'm working on it.
I have attention problems from flashing lights and moving things which atract me too much and the phone screen turning on and me having to act because of that is part of an issue to me.

Describe the solution you'd like

  1. If these are true:
    1.1 Ctrl+o or --screen-off (command line option) is more recent than Ctrl+Shift+o
    1.2. A command is sent to the phone, through scrcpy that is known to turn the screen on.
    1.3. The screen tries to turn on in the following X (maybe 5) seconds.
    1.3.1. 1.1. is still true
    ---> Turn the screen back off ASAP

Describe alternatives you've considered
I tried to use an automation tool that detects right clicks and Ctrl+p on the desktop app but it works like a terrible hack. Sometimes the command goes too early, other times the second command is mixed together with something else I'm trying to do.
In those cases, I have already ended up giving orders for things I didn't mean to.

Extra:
I intent to implement this myself. It can also allow me to familiarize with these workings of android.
This issue is to confirm if I have green light for such feature in scrcpy

@rom1v
Copy link
Collaborator

rom1v commented Jul 7, 2020

Sometimes I disconnect my phone from the PC and the screen if left off.

This is related to #1572, right?

A command is sent to the phone that is known to turn the screen on.

You can't know, the user could press the physical power button for example.

Trying to work around the Android behavior, which is to reset the power mode to NORMAL when pressing the power button, with time-based heuristics looks very hacky/unreliable to me.

Ref: #618 (comment)
Ref: #760

@brunoais
Copy link
Contributor Author

brunoais commented Jul 7, 2020

You can't know, the user could press the physical power button for example.

That is a problem outside the scope of this issue.
I guess I wasn't clear in the first comment, sorry. I'll try to change it.

Trying to work around the Android behavior, which is to reset the power mode to NORMAL when pressing the power button, with time-based heuristics looks very hacky/unreliable to me.

I think so too. I want to try finding something that doesn't look hacky like that.
Regardless, this is about actions done through this app and has nothing to do with what you do with your phone's physical buttons 👍

@brunoais
Copy link
Contributor Author

brunoais commented Jul 8, 2020

I just noticed the first part in this issue is the same as the other one. I think this was the automatic draft saving from the other issue and I was blinded from seeing it properly. I removed that part now.

@brunoais
Copy link
Contributor Author

brunoais commented Jul 8, 2020

@rom1v Do you know any way to know whether the screen is on or off?
All ways I got to find can't detect the screen off by changing the screen power mode, which is how scrcpy.
Maybe whatever solution I get may not use that.

rom1v pushed a commit that referenced this issue Aug 3, 2020
rom1v pushed a commit that referenced this issue Aug 6, 2020
PR #1577 <#1577>
Fixes #1573 <#1573>

Signed-off-by: Romain Vimont <[email protected]>
@rom1v
Copy link
Collaborator

rom1v commented Aug 6, 2020

Merged cf9d449

@rom1v rom1v closed this as completed Aug 6, 2020
@rom1v rom1v mentioned this issue May 3, 2023
1 task
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

2 participants