mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-24 07:32:51 +00:00
Make each Zed instance use half the screen in 'start-local-collaboration' script
This commit is contained in:
parent
e4507c1d74
commit
82824f78b6
1 changed files with 17 additions and 8 deletions
|
@ -17,23 +17,32 @@ MESSAGE
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
github_login=$(curl -sH "Authorization: bearer $GITHUB_TOKEN" https://api.github.com/user | jq -r .login)
|
# Start one Zed instance as the current user and a second instance with a different user.
|
||||||
|
username_1=$(curl -sH "Authorization: bearer $GITHUB_TOKEN" https://api.github.com/user | jq -r .login)
|
||||||
other_github_login=nathansobo
|
username_2=nathansobo
|
||||||
if [[ $github_login == $other_github_login ]]; then
|
if [[ $username_1 == $username_2 ]]; then
|
||||||
other_github_login=as-cii
|
username_2=as-cii
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Make each Zed instance take up half of the screen.
|
||||||
|
screen_size=($(system_profiler SPDisplaysDataType | grep Resolution | head -n1 | egrep -o '[0-9]+'))
|
||||||
|
width=$(expr ${screen_size[0]} / 2)
|
||||||
|
height=${screen_size[1]}
|
||||||
|
position_1=0,0
|
||||||
|
position_2=${width},0
|
||||||
|
|
||||||
|
# Authenticate using the collab server's admin secret.
|
||||||
export ZED_ADMIN_API_TOKEN=secret
|
export ZED_ADMIN_API_TOKEN=secret
|
||||||
export ZED_SERVER_URL=http://localhost:8080
|
export ZED_SERVER_URL=http://localhost:8080
|
||||||
export ZED_WINDOW_SIZE=800,600
|
export ZED_WINDOW_SIZE=${width},${height}
|
||||||
|
|
||||||
cargo build
|
cargo build
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
|
|
||||||
|
# Start the two Zed child processes. Open the given paths with the first instance.
|
||||||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
|
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
|
||||||
ZED_WINDOW_POSITION=0,0 ZED_IMPERSONATE=${github_login} target/debug/Zed $@ &
|
ZED_IMPERSONATE=${username_1} ZED_WINDOW_POSITION=${position_1} target/debug/Zed $@ &
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
ZED_WINDOW_POSITION=800,0 ZED_IMPERSONATE=${other_github_login} target/debug/Zed &
|
ZED_IMPERSONATE=${username_2} ZED_WINDOW_POSITION=${position_2} target/debug/Zed &
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
wait
|
wait
|
||||||
|
|
Loading…
Reference in a new issue