Skip to content

Instantly share code, notes, and snippets.

@superkojiman
Created November 27, 2022 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save superkojiman/0b400e14faf4b2efb310610639c112f1 to your computer and use it in GitHub Desktop.
Save superkojiman/0b400e14faf4b2efb310610639c112f1 to your computer and use it in GitHub Desktop.
Match the brightness level on all connected displays.
"""
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