blob: 0e9c140256bf51c4edc29b16c082badede404e19 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# Store the first argument passed to the script in the variable aerospace_path
aerospace_path=$1
# Get the status of System Integrity Protection (SIP) and store it in the variable SIP
SIP=$(csrutil status)
# List monitors using the aerospace tool, format the output as JSON, and store it in the variable displays
# Redirect any error output to /dev/null
displays=$($aerospace_path list-monitors --json --format "%{monitor-id} %{monitor-name} %{monitor-appkit-nsscreen-screens-id}" 2> /dev/null)
# Check if the previous command failed (exit status 1)
if [ $? -eq 1 ]; then
# Print "aerospaceError" and exit the script with status 0
echo "aerospaceError"
exit 0
fi
# Print a JSON object containing the displays information, SIP status, and a shadow property set to true
echo $(cat <<-EOF
{
"displays": $displays,
"SIP": "$SIP",
"shadow": true
}
EOF
)
|