From 9bc68fa7cf3ff632ff0d4a2299f29459cd765d29 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Fri, 1 Apr 2022 00:29:48 -0400 Subject: [PATCH] fix(qtile): check if backlight present before parsing --- users/infinidoge/config/qtile/config.py | 34 +++++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/users/infinidoge/config/qtile/config.py b/users/infinidoge/config/qtile/config.py index 76010e3..aa4a685 100644 --- a/users/infinidoge/config/qtile/config.py +++ b/users/infinidoge/config/qtile/config.py @@ -580,21 +580,27 @@ def init_widget_list(main=True, laptop=False): *optional_list( laptop, [ - [ - widget.TextBox(text=" 🔆", padding=0, fontsize=14), - widget.Backlight( - backlight_name=( - run_command( - "brightnessctl -lm | grep backlight" - ) - .splitlines()[0] - .split(",")[0] + ( + [ + widget.TextBox( + text=" 🔆", padding=0, fontsize=14 ), - change_command="brightnessctl set {0}%", - step=5, - padding=5, - ), - ], + widget.Backlight( + backlight_name=( + backlight.splitlines()[0].split(",")[0] + ), + change_command="brightnessctl set {0}%", + step=5, + padding=5, + ), + ] + if ( + backlight := run_command( + "brightnessctl -lm | grep backlight" + ) + ) + else [] + ), [ # TODO: Create battery icon widget using NerdFont icons widget.Battery( format="{char} {percent:2.1%} {hour:d}h:{min:02d}m",