dec-brightness 528 B

1234567891011121314151617
  1. #!/bin/sh
  2. # script to decrease the display brightness by $1%
  3. [ -z "$1" ] && echo "Error: please give percent as argument" && exit 1
  4. #xbacklight -dec "$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. brightnessctl -d "${device}" set "$brightness"%