distribution/packages/sysutils/autostart/sources/common/006-brightness
fewtarius a837478baf
* Distribution updates - kernel 6.1.10, Python, systemd, busybox, SDL2, etc.
* Update emulators, cores, and art book next theme.
* Drop -Ofast, --disable-shared --enable-static as defaults.
* Misc build fixes.
2023-02-08 12:26:54 -05:00

24 lines
642 B
Bash
Executable file

#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
. /etc/profile
### Variables may need to be device specific here.
BRIGHTNESS=$(get_setting system.brightness)
if [[ ! "${BRIGHTNESS}" =~ [0-9] ]]
then
BRIGHTNESS=${DEVICE_BRIGHTNESS}
fi
# Ensure user doesn't get "locked out" with super low brightness
if [[ "${BRIGHTNESS}" -lt "3" ]]
then
BRIGHTNESS=3
fi
BRIGHTNESS_DEVICE="$(brightness device)"
if [ -e "/sys/class/backlight/${BRIGHTNESS_DEVICE}/brightness" ]
then
printf "%.0f" $(echo "${BRIGHTNESS}") > /sys/class/backlight/${BRIGHTNESS_DEVICE}/brightness
fi