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

set display brightness #101

Closed
anishbajpai014 opened this issue Mar 29, 2018 · 7 comments
Closed

set display brightness #101

anishbajpai014 opened this issue Mar 29, 2018 · 7 comments

Comments

@anishbajpai014
Copy link

It would be great if scrcpy could set device brightness to 0 on start and reset it on exit.
The current value can be accessed using adb shell settings get system screen_brightness, and can be set using adb shell settings put system screen_brightness XX where XX ranges from 0 to 255.

On a side note, maybe a user can be allowed to run scripts at the start and exit of scrcpy.

@anishbajpai014
Copy link
Author

All of this can be achieved using a bash script.
Closing.

@rom1v
Copy link
Collaborator

rom1v commented Mar 29, 2018

The current value can be accessed using adb shell settings get system screen_brightness, and can be set using adb shell settings put system screen_brightness XX where XX ranges from 0 to 255.

For completeness, screen_brightness_mode must also be set to 0:

adb shell settings put system screen_brightness_mode 0
adb shell settings put system screen_brightness 0

On a side note, maybe a user can be allowed to run scripts at the start and exit of scrcpy.

See #96.

All of this can be achieved using a bash script.

😉

I still implemented show touches as an option. I don't know if brightness deserve its own option too… For now, I don't think so.

@anishbajpai014
Copy link
Author

anishbajpai014 commented Mar 30, 2018

I don't know if brightness deserve its own option too

Yeah you're right. A wrapper script is more than enough.
Script samples for the most frequent actions can be added to the readme though.

For example, this is the function I'm using -

function scrcpy () {
	brightness=$(adb shell settings get system screen_brightness)
	adb shell settings put system screen_brightness_mode 0
	adb shell settings put system screen_brightness 0
	adb shell svc power stayon usb
	command scrcpy
	adb shell settings put system screen_brightness_mode 1
	adb shell settings put system screen_brightness $brightness
	adb shell svc power stayon false
}

@rom1v
Copy link
Collaborator

rom1v commented Mar 30, 2018

👍

One question: I never used the command built-in bash command. What's the benefit concretely.

As a suggestion, you could forward the arguments to scrcpy:

    command scrcpy "$@"

@anishbajpai014
Copy link
Author

The command function is there only because I wanted the function to have the same name.
If this function is called without command, it will keep calling itself recursively.

Totally forgot about passing the arguments. Thank you!

@rom1v
Copy link
Collaborator

rom1v commented May 31, 2019

A shortcut to turn device screen off is implemented on dev by 12a3bb2.

@pcgeek86
Copy link

FYI adb shell settings put system screen_brightness 30 doesn't work on Android TV. I'm trying it out on a Sony XBR X950G.

Anyone have alternative options to set screen brightness on Android TV?

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

No branches or pull requests

3 participants