Commit 762ea6bc authored by Nico Schottelius's avatar Nico Schottelius

Add new script to manage brightness

parent 822d11cd
import glob
import os
import argparse
def get_dirs():
return glob.glob("{}*".format(basepath)):
def get_driver_from_dir(directory):
regexp = r"{}(?P<driver>.+)".format(basepath)
return re.match(regexp, directory).groupdict()['driver']
for dir in
valf = os.path.join(dir, "brightness")
maxf = os.path.join(dir, "max_brightness")
with open(valf, "r") as fd:
val = int("".join(fd.readlines()))
with open(maxf, "r") as fd:
maxval = int("".join(fd.readlines()))
percent = (val/maxval)*100
print("{} {} = {:.2f}%".format(val,maxval,percent))
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='cbacklight')
parser.add_argument('--inc', help='Increment by percentage (points)')
parser.add_argument('--dec', help='Decrement by percentage (points)')
parser.add_argument('--set', help='Set to percentage')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment