Created
November 27, 2022 19:27
-
-
Save superkojiman/0b400e14faf4b2efb310610639c112f1 to your computer and use it in GitHub Desktop.
Match the brightness level on all connected displays.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Match the brightness level on all connected displays. | |
Usage: bright.py 50 | |
Requires https://pypi.org/project/screen-brightness-control/ | |
""" | |
import sys | |
import screen_brightness_control as sbc | |
def usage(): | |
print("Usage: bright.py [0..100]") | |
if __name__ == "__main__": | |
if len(sys.argv) > 1 and (int(sys.argv[1]) > 1 and int(sys.argv[1]) <= 100): | |
print(f"Setting brightness to {sys.argv[1]}") | |
for display in sbc.list_monitors(): | |
sbc.set_brightness(int(sys.argv[1]), display=display) | |
else: | |
usage() | |
for display in sbc.list_monitors(): | |
print(f"{display}: {sbc.get_brightness(display)[0]}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment