I've spent some time researching where these options are actually stored, and found them in all locked away in
For those who are interested in our solution, here is the script that I wrote up:
#!/bin/bash
##########################################################################################################################################################
#
# Set Display Settings
# Written by KClose
# Created: January 30, 2024
#
# Sets the default Brightness level, Auto Brightness option, and True Tone option.
# The plist is only read upon startup, so changing these settings via this script will not take effect until the first restart after the script is run.
#
##########################################################################################################################################################
### FETCH VARIABLES ###
# Set empty variables
trueTone=""
autoBright=""
brightLevel=""
# Fetch True Tone option.
if [[ $4 == [Nn] ]]; then
echo "True Tone will be disabled."
trueTone="0"
elif [[ $4 == [Yy] ]]; then
echo "True Tone will be enabled."
trueTone="1"
else
echo "True Tone option will not be changed."
fi
# Fetch Auto Brightness option.
if [[ $5 == [Nn] ]]; then
echo "Auto Brightness will be disabled."
autoBright="false"
elif [[ $5 == [Yy] ]]; then
echo "Auto Brightness will be enabled."
autoBright="true"
else
echo "Auto Brightness option will not be changed."
fi
# Fetch Brightness Level
# The recomended value at the time this script was written is a real number between 3 and 525.
# This value was derived from an M1 iMac.
[[ -z "$6" ]] && { echo "Brightness Level will not be changed."; } || { brightLevel="$6"; echo "Brightness Level will be set to $brightLevel"; }
# Fetch Current User
currentUser=$(echo "show State:/Users/ConsoleUser" | scutil | awk '/Name
{ print $3 }')
# Fetch GUID of Current User
userID=$(dscl . -read /Users/$currentUser/ GeneratedUID | awk -F': ' '{print $2}')
# Shortcut the PlistBuddy command for convnience.
plistPal="/usr/libexec/PlistBuddy"
# Define the Configuration File locations.
configRoot="/private/var/root/Library/Preferences/com.apple.CoreBrightness.plist"
# Fetch ID of Primary Display
displayID=$($plistPal -c "Print :DisplayPreferences:" "$configRoot" | grep "= Dict" | grep -v AutoBrightnessCurve | awk '{print $1}')
### MAIN SCRIPT ###
# Set options in the root Plist
[[ ! -z "$trueTone" ]] && { $plistPal -c "Set :CBUser-$userID:CBColorAdaptationEnabled $trueTone" "$configRoot"; }
[[ ! -z "$autoBright" ]] && { $plistPal -c "Set :DisplayPreferences:$displayID:AutoBrightnessEnable $autoBright" "$configRoot"; }
[[ ! -z "$brightLevel" ]] && { $plistPal -c "Set :DisplayPreferences:$displayID:BrightnessLevelNits $brightLevel" "$configRoot"; }
exit 0