Updated brightness to use a custom bash script instead of brightnessctl
This commit is contained in:
22
.config/i3/brightness.sh
Executable file
22
.config/i3/brightness.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $# != 1 ]]; then
|
||||
echo "Usage: $0 <brightness percentage>"
|
||||
echo "Example: $0 5 # Increase brighness by 5%"
|
||||
echo "Example: $0 -5 # Decrease brighness by 5%"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
file_root="/sys/class/backlight/$(ls /sys/class/backlight | head -n 1)"
|
||||
max=$(cat "$file_root/max_brightness")
|
||||
current=$(cat "$file_root/actual_brightness")
|
||||
new=$(($current + ($max / 100 * $1)))
|
||||
|
||||
|
||||
if [ "$new" -ge "$max" ]; then
|
||||
echo "$max" > $file_root/brightness
|
||||
elif [ "$new" -le "0" ]; then
|
||||
echo "0" > $file_root/brightness
|
||||
else
|
||||
echo "$new" > $file_root/brightness
|
||||
fi
|
||||
@@ -154,8 +154,8 @@ bindsym l resize shrink width 10 px or 10 ppt
|
||||
bindsym $mod+r mode "resize"
|
||||
|
||||
# Brightness keys setup
|
||||
bindsym XF86MonBrightnessDown exec --no-startup-id "brightnessctl set 5%-"
|
||||
bindsym XF86MonBrightnessUp exec --no-startup-id "brightnessctl set +5%"
|
||||
bindsym XF86MonBrightnessDown exec --no-startup-id "sudo $HOME/.config/i3/brightness.sh -5"
|
||||
bindsym XF86MonBrightnessUp exec --no-startup-id "sudo $HOME/.config/i3/brightness.sh 5"
|
||||
|
||||
# Window Cosmetic Changes
|
||||
gaps inner 10
|
||||
|
||||
Reference in New Issue
Block a user