distribution/packages/jelos/autostart/006-display
fewtarius fb954b97fa
x55, ES, UI Updates
* Set correct rotation when connected to HDMI on Powkiddy x55.
* Deprecate EmulationStation splash screen.
* Fix bug setting 16:10 aspect ratio - move redundant script bits to a global function.
* Experiment with ES defaults.
2023-07-22 23:56:23 +00:00

44 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
. /etc/profile
tocon "Configuring display..."
### Variables may need to be device specific here.
BRIGHTNESS=$(get_setting system.brightness)
if [[ ! "${BRIGHTNESS}" =~ [0-9] ]]
then
if [ "${DEVICE_BRIGHTNESS}" = "hardware" ]
then
BRIGHTNESS=$(cat /sys/class/backlight/$(brightness device)/brightness 2>/dev/null)
else
BRIGHTNESS=${DEVICE_BRIGHTNESS}
fi
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
### Set the aspect ratio in ES.
ASPECT=$(get_aspect_ratio)
ES_CONFIG="/storage/.config/emulationstation/es_settings.cfg"
ES_ASPECT="${ASPECT/:/-}"
if [ "$(grep subset.aspect-ratio ${ES_CONFIG})" ]
then
sed -i 's|<string name="subset.aspect-ratio".*$|<string name="subset.aspect-ratio" value="'${ES_ASPECT}'"/>|g' ${ES_CONFIG}
else
sed -i '/<\/config>/i \\t<string name="subset.aspect-ratio" value="'${ES_ASPECT}'"/>' ${ES_CONFIG}
fi