diff options
Diffstat (limited to 'users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-aerospace.sh')
| -rwxr-xr-x | users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/init-aerospace.sh | 26 |
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 | ||
| 2 | aerospace_path=$1 | ||
| 3 | |||
| 4 | # Get the status of System Integrity Protection (SIP) and store it in the variable SIP | ||
| 5 | SIP=$(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 | ||
| 9 | displays=$($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) | ||
| 12 | if [ $? -eq 1 ]; then | ||
| 13 | # Print "aerospaceError" and exit the script with status 0 | ||
| 14 | echo "aerospaceError" | ||
| 15 | exit 0 | ||
| 16 | fi | ||
| 17 | |||
| 18 | # Print a JSON object containing the displays information, SIP status, and a shadow property set to true | ||
| 19 | echo $(cat <<-EOF | ||
| 20 | { | ||
| 21 | "displays": $displays, | ||
| 22 | "SIP": "$SIP", | ||
| 23 | "shadow": true | ||
| 24 | } | ||
| 25 | EOF | ||
| 26 | ) \ No newline at end of file | ||
