Skip to content

Commit eb55453

Browse files
committed
Fix fade_brightness for users with only xbacklight installed
1 parent 3080e3b commit eb55453

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

screen_brightness_control/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,12 @@ def fade(start, finish, increment, monitor):
197197
)}
198198
)
199199
except (IndexError, LookupError) as e:
200-
# fix this breaking if user ONLY has xbacklight installed
201-
raise ScreenBrightnessError(f'\n\tfilter_monitors -> {type(e).__name__}: {e}')
200+
if type(e) == LookupError and platform.system() == 'Linux' and method is None:
201+
# if a user ONLY has XBacklight installed and no method was specified
202+
# then filter_monitors will raise a LookupError
203+
available_monitors = [method.XBacklight]
204+
else:
205+
raise ScreenBrightnessError(f'\n\tfilter_monitors -> {type(e).__name__}: {e}')
202206
except ValueError as e:
203207
if platform.system() == 'Linux' and (str(kwargs.get('method', '')).lower() == 'xbacklight'):
204208
available_monitors = [method.XBacklight]

0 commit comments

Comments
 (0)