Add brightness control scripts

This commit is contained in:
Andreas Tsouchlos 2024-08-25 15:45:28 +02:00
parent ef74b0e660
commit b99e5a5ec3
3 changed files with 38 additions and 2 deletions

View File

@ -45,8 +45,8 @@ bindsym XF86AudioPause exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
bindsym XF86MonBrightnessUp exec brightnessctl set +5%
bindsym XF86MonBrightnessDown exec brightnessctl set 5%-
bindsym XF86MonBrightnessUp exec /bin/sh -c ~/.config/sway/scripts/increase_brightness
bindsym XF86MonBrightnessDown exec /bin/sh -c ~/.config/sway/scripts/decrease_brightness
bindsym $mod+c exec kitty -e python

View File

@ -0,0 +1,18 @@
#!/bin/sh
export BRIGHTNESS=`brightnessctl g`
if [ $BRIGHTNESS -gt 0 ]; then
brightnessctl set 5%-
else
killall gammastep &> /dev/null
export BRIGHTNESS=`cat /tmp/brightness 2> /dev/null || echo 1`
if [ `echo "$BRIGHTNESS > 0.1" | bc -l` == 1 ]; then
export BRIGHTNESS=`echo "$BRIGHTNESS - 0.1" | bc`
echo $BRIGHTNESS > /tmp/brightness
gammastep -O 6500 -b $BRIGHTNESS:0.1 &
else
gammastep -O 6500 -b 0.1:0.1 &
fi
fi

View File

@ -0,0 +1,18 @@
#!/bin/sh
export BRIGHTNESS=`brightnessctl g`
if [ $BRIGHTNESS == 0 ]; then
killall gammastep &> /dev/null
export BRIGHTNESS=`cat /tmp/brightness 2> /dev/null || echo 1`
if [ `echo "$BRIGHTNESS < 1.0" | bc -l` == 1 ]; then
export BRIGHTNESS=`echo "$BRIGHTNESS + 0.1" | bc`
echo $BRIGHTNESS > /tmp/brightness
gammastep -O 6500 -b $BRIGHTNESS:0.1 &
else
brightnessctl set 5%
fi
else
brightnessctl set +5%
fi