aboutsummaryrefslogtreecommitdiff
path: root/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-aerospace.sh
diff options
context:
space:
mode:
Diffstat (limited to 'users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-aerospace.sh')
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-aerospace.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-aerospace.sh b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-aerospace.sh
new file mode 100755
index 0000000..0e9c140
--- /dev/null
+++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-aerospace.sh
@@ -0,0 +1,26 @@
1# Store the first argument passed to the script in the variable aerospace_path
2aerospace_path=$1
3
4# Get the status of System Integrity Protection (SIP) and store it in the variable SIP
5SIP=$(csrutil status)
6
7# List monitors using the aerospace tool, format the output as JSON, and store it in the variable displays
8# Redirect any error output to /dev/null
9displays=$($aerospace_path list-monitors --json --format "%{monitor-id} %{monitor-name} %{monitor-appkit-nsscreen-screens-id}" 2> /dev/null)
10
11# Check if the previous command failed (exit status 1)
12if [ $? -eq 1 ]; then
13 # Print "aerospaceError" and exit the script with status 0
14 echo "aerospaceError"
15 exit 0
16fi
17
18# Print a JSON object containing the displays information, SIP status, and a shadow property set to true
19echo $(cat <<-EOF
20 {
21 "displays": $displays,
22 "SIP": "$SIP",
23 "shadow": true
24 }
25EOF
26) \ No newline at end of file