123456789101112131415161718 |
- # shellcheck shell=sh
- (
- : "${BRIGHTNESS_DEV:=/sys/class/backlight/intel_backlight}"
- : "${BRIGHTNESS_SAVE:=/var/cache/brightness}"
- [ -r "${BRIGHTNESS_SAVE}" ] || exit
- read -r brightness < "${BRIGHTNESS_SAVE}"
- [ "${brightness}" -gt 100 ] || exit
- msg 'restoring brightness'
- [ -w "${BRIGHTNESS_DEV}/brightness" ] \
- && printf '%d' "${brightness}" > "${BRIGHTNESS_DEV}/brightness" \
- || error 'unable to restore brightness' \
- "(failed to write to '${BRIGHTNESS_DEV}/brightness')"
- ) &
|