avd/cmd/lowerbl

14 lines
380 B
Plaintext
Raw Permalink Normal View History

#!/bin/bash
read -r -d '' bl_dir < \
<(find /sys/class/backlight -mindepth 1 -maxdepth 1 -print0 | head -z -n 1)
read -r max_bl < "${bl_dir}"/max_brightness
delta=$((max_bl / 10))
bl_file="${bl_dir}"/brightness
read -r bl < "${bl_file}"
bl2=$((bl - delta))
if [[ "${bl2}" -lt 0 ]]; then bl2=0; fi
printf '%s' "${bl2}" | sudo tee "${bl_file}" &> /dev/null
"${0%/*}"/../avds bl