Created
July 24, 2015 05:46
-
-
Save d9k/275d9f970b4fd3b478dc to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python3 | |
# change brightness level on all monitors simultaneously on linux ubuntu | |
import os | |
import re | |
from sys import argv | |
try: | |
brightness_level = float(argv[1]) | |
except IndexError: | |
brightness_level = 1.0 | |
if brightness_level <= 0: | |
brightness_level = 0.1 | |
xrandr_lines = os.popen("xrandr").read() | |
outputs = re.findall(r'([\-\w]+) connected', xrandr_lines, re.M) | |
for output in outputs: | |
os.popen("xrandr --output " + output + " --brightness " + str(brightness_level)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment