Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
List all display sizes and origins in /Library/Preferences/com.apple.windowserver.plist
#!/bin/bash
output=""
numDisplaySets=`/usr/libexec/PlistBuddy -c "Print DisplaySets" /Library/Preferences/com.apple.windowserver.plist | grep -E '^ Array' | wc -l`
for (( curDisplaySetNum=0; curDisplaySetNum<$numDisplaySets; curDisplaySetNum++ ))
do
echo "DisplaySet "$curDisplaySetNum
curDisplayNum=0
notdone=1
while [[ "$notdone" -ne 0 ]]
do
cur=`echo -e "Print DisplaySets:"$curDisplaySetNum":"$curDisplayNum":Width\nPrint DisplaySets:"$curDisplaySetNum":"$curDisplayNum":Height\nPrint DisplaySets:"$curDisplaySetNum":"$curDisplayNum":OriginX\nPrint DisplaySets:"$curDisplaySetNum":"$curDisplayNum":OriginY" | /usr/libexec/PlistBuddy ~/Library/Preferences/ByHost/com.apple.windowserver.*.plist 2>&1 | sed -e 's/Command: //g'`
if [[ $cur == *"Does Not Exist"* ]]
then
notdone=0
else
echo " "$cur
fi
#echo $cur
curDisplayNum=`echo $curDisplayNum+1 | bc`
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.