feat(qtile): add brightness management

This commit is contained in:
Infinidoge 2022-03-29 10:40:45 -04:00
parent e0ca9ae307
commit 8ce7433122
2 changed files with 39 additions and 4 deletions

View file

@ -83,6 +83,10 @@ class Keys:
NUM_LOCK = "mod2" NUM_LOCK = "mod2"
def run_command(*args, **kwargs):
return os.popen(*args, **kwargs).read()
# fmt: off # fmt: off
keys = [ keys = [
# Switch between windows # Switch between windows
@ -330,6 +334,18 @@ keys = [
desc="Toggle mute", desc="Toggle mute",
), ),
# Brightness
Key(
[], "XF86MonBrightnessUp",
lazy.spawn("brightnessctl set +5%"),
desc="Increase brightness",
),
Key(
[], "XF86MonBrightnessDown",
lazy.spawn("brightnessctl set 5%-"),
desc="Decrease brightness",
),
# Application shortcuts # Application shortcuts
Key( Key(
[Keys.SUPER], "Return", [Keys.SUPER], "Return",
@ -533,11 +549,9 @@ def init_widget_list(main=True, laptop=False):
), ),
] ]
for i, interface in enumerate( for i, interface in enumerate(
os.popen( run_command(
"ifconfig -s | awk {'print $1'} | grep -Ev -e Iface -e lo -e vir.+ -e docker.+ | tac" "ifconfig -s | awk {'print $1'} | grep -Ev -e Iface -e lo -e vir.+ -e docker.+ | tac"
) ).splitlines()
.read()
.splitlines()
) )
], ],
[], [],
@ -564,6 +578,25 @@ def init_widget_list(main=True, laptop=False):
], ],
*( *(
[ [
[
widget.TextBox(
text=" 🔆",
padding=0,
fontsize=14,
),
widget.Backlight(
backlight_name=(
run_command(
"brightnessctl -lm | grep backlight"
)
.splitlines()[0]
.split(",")[0]
),
change_command="brightnessctl set {0}%",
step=5,
padding=5,
),
],
[ [
widget.Battery( widget.Battery(
format="{char} {percent:2.1%} {hour:d}h:{min:02d}m", format="{char} {percent:2.1%} {hour:d}h:{min:02d}m",

View file

@ -45,7 +45,9 @@ in
teams teams
libsForQt5.dolphin libsForQt5.dolphin
flameshot flameshot
brightnessctl
sxiv sxiv