Debian Codegraph @

plyer/platforms/linux/brightness.py

raw symbols SCIP
1 '''
2 Linux Brightness
3 ----------------
4
5 '''
6
7 from plyer.facades import Brightness
8 import subprocess
9 import os
10
11
12 class LinuxBrightness(Brightness):
13
14 def __init__(self):
15 if os.system("which xbacklight"):
16 msg = ("It looks like 'xbacklight' is not installed. Try "
17 "installing it with your distribution's package manager.")
18 raise Exception(msg)
19
20 def _current_level(self):
21 cr_level = subprocess.check_output(["xbacklight", "-get"])
22 return str(cr_level)
23
24 def _set_level(self, level):
25 subprocess.call(["xbacklight", "-set", str(level)])
26
27
28 def instance():
29 return LinuxBrightness()