From 012442b93e9c29f03b0fd1af417e8b681a42673b Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 1 Feb 2015 14:41:12 +0100 Subject: [PATCH] do not assume xbacklight is installed --- dsl.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dsl.py b/dsl.py index ccd70ce..13a97f8 100755 --- a/dsl.py +++ b/dsl.py @@ -252,9 +252,12 @@ if __name__ == "__main__": # make sure the internal screen is really, *really* turned on if there is no external screen if not hasExternal: - backlight = float(subprocess.check_output(["xbacklight", "-get"]).strip()) - if backlight == 0: # it's completely turned off, we better enable it - subprocess.check_call(["xbacklight", "-set", "100"]) + try: + backlight = float(subprocess.check_output(["xbacklight", "-get"]).strip()) + if backlight == 0: # it's completely turned off, we better enable it + subprocess.check_call(["xbacklight", "-set", "100"]) + except FileNotFoundError: + print("xbacklight has not been found, unable to turn your laptop backlight on.") except Exception as e: frontend.error(str(e)) raise -- 2.30.2