Skip to content

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

Closed

Description

@brunoais

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

Activity

  1. rom1v commented on Jul 7, 2020

    @rom1v
    Collaborator

    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

  2. brunoais commented on Jul 7, 2020

    @brunoais
    ContributorAuthor

    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 👍

  3. brunoais commented on Jul 8, 2020

    @brunoais
    ContributorAuthor

    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.

  4. brunoais commented on Jul 8, 2020

    @brunoais
    ContributorAuthor

    @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.

  5. added 2 commits that reference this issue on Aug 3, 2020
    2a7f3d7
    cf9d449
  6. rom1v commented on Aug 6, 2020

    @rom1v
    Collaborator

    Merged cf9d449

  7. added a commit that references this issue on Nov 19, 2026
    919ced6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions