Merge pull request #11 from ESHARK22/refact_typos

Fix some english typos
This commit is contained in:
steel99xl 2025-03-17 17:27:22 -04:00 committed by GitHub
commit ce98f0cc8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 17 deletions

View file

@ -1,18 +1,18 @@
#!/bin/bash #!/bin/bash
#How much light change must be seen by the sensor befor it will act #How much light change must be seen by the sensor before it will act
LightChange=10 LightChange=10
#How often it check the sensor #How often it check the sensor
SensorDelay=1 SensorDelay=1
# Scale sesor to displas brightness range # Scale sensor to display brightness range
# NOW WITH FLOAT SUPPORT # NOW WITH FLOAT SUPPORT
SensorToDisplayScale=24.09 SensorToDisplayScale=24.09
# 12 steps is the most similar on a Macbook 2017 running Arch compared to MacOS # 12 steps is the most similar on a Macbook 2017 running Arch compared to MacOS
LevelSteps=12 LevelSteps=12
# Playes the 12 stesp effectivly at 30 FPS 32ms # Plays the 12 step effectively at 30 FPS 32ms
AnimationDelay=0.032 AnimationDelay=0.032
@ -21,11 +21,11 @@ MinimumBrightness=001
# 2 : Default | 1 : Add Offset | 0 : Subtract Offset, Recomended not to change # 2 : Default | 1 : Add Offset | 0 : Subtract Offset, Recommended not to change
op=2 op=2
# Only look for flags -i or -d with an aditional value # Only look for flags -i or -d with an additional value
# AutomaticBrightness.sh -i 100 # AutomaticBrightness.sh -i 100
while getopts i:d: flag while getopts i:d: flag
do do
@ -37,7 +37,7 @@ do
esac esac
done done
# Verigy offset file exsits and if so read it # Verify offset file exists and if so read it
if [[ -f /dev/shm/AB.offset ]] if [[ -f /dev/shm/AB.offset ]]
then then
OffSet=$(cat /dev/shm/AB.offset) OffSet=$(cat /dev/shm/AB.offset)
@ -50,7 +50,7 @@ fi
#if no offset or its less than 0 make 0 #if no offset or its less than 0 make 0
OffSet=$((OffSet < 0 ? 0 : OffSet)) OffSet=$((OffSet < 0 ? 0 : OffSet))
# relativly change number in Offset file and write it # relatively change number in Offset file and write it
if [[ $op -lt 2 ]] if [[ $op -lt 2 ]]
then then
if [[ $op -eq 1 ]] if [[ $op -eq 1 ]]
@ -117,15 +117,15 @@ do
CurrentBrightness=$(cat $BLightPath) CurrentBrightness=$(cat $BLightPath)
# Add MinimumBrighness here to not effect comparison but the outcome # Add MinimumBrightness here to not effect comparison but the outcome
Light=$(LC_NUMERIC=C printf "%.0f" $(echo "scale=2; $Light + ( ($MaxScreenBrightness * ( $MinimumBrightness / 100 )) / $SensorToDisplayScale ) " | bc )) Light=$(LC_NUMERIC=C printf "%.0f" $(echo "scale=2; $Light + ( ($MaxScreenBrightness * ( $MinimumBrightness / 100 )) / $SensorToDisplayScale ) " | bc ))
# Gernate a TempLight value for the screen to be set to # Generate a TempLight value for the screen to be set to
# Float math thanks Matthias_Wachter # Float math thanks Matthias_Wachter
TempLight=$(LC_NUMERIC=C printf "%.0f" $(echo "scale=2; $Light * $SensorToDisplayScale" | bc)) TempLight=$(LC_NUMERIC=C printf "%.0f" $(echo "scale=2; $Light * $SensorToDisplayScale" | bc))
# Check we dont ask the screen to go brighter than it can # Check we do not ask the screen to go brighter than it can
if [[ $TempLight -gt $MaxScreenBrightness ]] if [[ $TempLight -gt $MaxScreenBrightness ]]
then then
NewLight=$MaxScreenBrightness NewLight=$MaxScreenBrightness
@ -133,7 +133,7 @@ do
NewLight=$TempLight NewLight=$TempLight
fi fi
# How diffrent should each stop be # How different should each stop be
DiffCount=$(LC_NUMERIC=C printf "%.0f" $(echo "scale=2; ( $NewLight - $CurrentBrightness ) / $LevelSteps" | bc )) DiffCount=$(LC_NUMERIC=C printf "%.0f" $(echo "scale=2; ( $NewLight - $CurrentBrightness ) / $LevelSteps" | bc ))
# Step once per Screen Hz to make animation # Step once per Screen Hz to make animation
@ -156,7 +156,7 @@ do
echo $FakeLight > $BLightPath echo $FakeLight > $BLightPath
fi fi
# Format values apropriatly for brightnessctl # Format values appropriately for brightnessctl
#if [[ $NewLight -lt 0 ]] #if [[ $NewLight -lt 0 ]]
#then #then
#NewLight=$( echo "$NewLight" | awk -F "-" {'print$2'}) #NewLight=$( echo "$NewLight" | awk -F "-" {'print$2'})
@ -165,7 +165,7 @@ do
#NewLight=$(echo +$NewLight) #NewLight=$(echo +$NewLight)
#fi #fi
# Adjust brightness relativly # Adjust brightness relatively
#brightnessctl -q s $NewLight #brightnessctl -q s $NewLight
# Sleep for the screen Hz time so he effect is visible # Sleep for the screen Hz time so he effect is visible
sleep $AnimationDelay sleep $AnimationDelay

View file

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
# #
case $1 in case $1 in
-u) echo "Updading Mac-like-automatic-brightness..." -u) echo "Updating Mac-like-automatic-brightness..."
echo "Stopping AB service..." echo "Stopping AB service..."
sudo systemctl kill AB sudo systemctl kill AB
echo "Updating AutomaticBrightness.sh..." echo "Updating AutomaticBrightness.sh..."
echo "Cloning AutomaticBrighness.sh..." echo "Cloning AutomaticBrightness.sh..."
sudo cp AutomaticBrightness.sh /usr/local/bin/AutomaticBrightness.sh sudo cp AutomaticBrightness.sh /usr/local/bin/AutomaticBrightness.sh
echo "Updating AB.service for systemD..." echo "Updating AB.service for systemD..."
echo "Cloning AB.service for systemD..." echo "Cloning AB.service for systemD..."
@ -44,7 +44,7 @@ then
awk -v new_phrase="$NewStep" '/LevelSteps=/{ print new_phrase; next } 1' AutomaticBrightness.sh > temp && mv temp AutomaticBrightness.sh awk -v new_phrase="$NewStep" '/LevelSteps=/{ print new_phrase; next } 1' AutomaticBrightness.sh > temp && mv temp AutomaticBrightness.sh
fi fi
echo "Cloning AutomaticBrighness.sh..." echo "Cloning AutomaticBrightness.sh..."
sudo cp AutomaticBrightness.sh /usr/local/bin/AutomaticBrightness.sh sudo cp AutomaticBrightness.sh /usr/local/bin/AutomaticBrightness.sh
sudo chmod u+x /usr/local/bin/AutomaticBrightness.sh sudo chmod u+x /usr/local/bin/AutomaticBrightness.sh
@ -52,7 +52,7 @@ echo "Cloning AB.service for systemD..."
sudo cp AB.service /etc/systemd/system/AB.service sudo cp AB.service /etc/systemd/system/AB.service
echo "Startin Service..." echo "Starting Service..."
sudo systemctl enable AB sudo systemctl enable AB
sudo systemctl start AB sudo systemctl start AB