Make the script more reliable

This commit is contained in:
Petros Amoiridis 2023-04-20 18:35:35 +03:00
parent ad71020990
commit b11e239779
No known key found for this signature in database

View File

@ -26,7 +26,7 @@ fi
# Make each Zed instance take up half of the screen. # Make each Zed instance take up half of the screen.
resolution_line=$(system_profiler SPDisplaysDataType | grep Resolution | head -n1) resolution_line=$(system_profiler SPDisplaysDataType | grep Resolution | head -n1)
screen_size=($(echo $resolution_line | egrep -o '[0-9]+')) screen_size=($(echo $resolution_line | egrep -o '\s*(\d+)\s*x\s*(\d+).*)' | egrep -o '[0-9]+'))
scale_factor=1 scale_factor=1
if [[ $resolution_line =~ Retina ]]; then scale_factor=2; fi if [[ $resolution_line =~ Retina ]]; then scale_factor=2; fi
width=$(expr ${screen_size[0]} / 2 / $scale_factor) width=$(expr ${screen_size[0]} / 2 / $scale_factor)
@ -36,6 +36,17 @@ y=0
position_1=0,${y} position_1=0,${y}
position_2=${width},${y} position_2=${width},${y}
# Uncomment the following for debugging purposes.
# echo "Resolution line: $resolution_line"
# echo "Screen size: $screen_size"
# echo "Screen size 0: ${screen_size[0]}"
# echo "Screen size 1: ${screen_size[1]}"
# echo "Scale factor: $scale_factor"
# echo "Width: $width"
# echo "Height: $height"
# echo "Position 1: $position_1"
# echo "Position 2: $position_2"
# Authenticate using the collab server's admin secret. # Authenticate using the collab server's admin secret.
export ZED_STATELESS=1 export ZED_STATELESS=1
export ZED_ADMIN_API_TOKEN=secret export ZED_ADMIN_API_TOKEN=secret