distribution/packages/jelos/autostart/006-display

37 lines
958 B
Text
Raw Normal View History

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
2022-02-05 14:23:32 +00:00
# Minimal OS variable loading for performance
. /etc/profile.d/001-functions
2022-02-05 14:23:32 +00:00
tocon "Configuring display..."
2022-02-05 14:23:32 +00:00
### Variables may need to be device specific here.
BRIGHTNESS=$(get_setting system.brightness)
if [[ -z ${BRIGHTNESS} ]]
2022-02-05 14:23:32 +00:00
then
BRIGHTNESS="6"
2022-02-05 14:23:32 +00:00
fi
# Ensure user doesn't get "locked out" with super low brightness
if [[ "${BRIGHTNESS}" = "0" ]]
2022-02-05 14:23:32 +00:00
then
BRIGHTNESS=1
2022-02-05 14:23:32 +00:00
fi
brightness set ${BRIGHTNESS}
### 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