inc-brightness 615 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. # script to increase the display brightness by $1%
  3. [ -z "$1" ] && echo "Error: please give percent as argument" && exit 1
  4. #xbacklight -inc "$1"
  5. #exit
  6. device=$(brightnessctl -l | grep "class 'backlight'" | tail -n +3 | awk '{print $2}' | tr -d "'")
  7. if brightnessctl -l | grep "class 'backlight'" | grep -q "^Device 'intel_backlight'"; then
  8. device="intel_backlight"
  9. fi
  10. brightness=$(brightnessctl -d "${device}" | grep Current | awk -F '[)(]' "{print \$2 + $1}")
  11. if [ "$(cat .config/norisa/brightness-state)" -eq "100" ]; then
  12. exit 1
  13. else
  14. brightnessctl -d "${device}" set "$brightness"%
  15. fi