2023-10-01 15:57:19 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
source /etc/default/waydroid-launcher
|
|
|
|
|
2023-10-02 21:04:40 -07:00
|
|
|
# Kill any previous remnants
|
2023-10-01 15:57:19 -07:00
|
|
|
if [ "$(systemctl is-active waydroid-container.service)" == 'active' ]; then
|
|
|
|
killall -9 weston
|
2023-10-01 18:11:06 -07:00
|
|
|
pkexec /usr/bin/waydroid-container-stop
|
2023-10-01 15:57:19 -07:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2023-10-02 21:04:40 -07:00
|
|
|
# Launch Weston
|
2023-10-01 15:57:19 -07:00
|
|
|
killall -9 weston
|
2023-10-01 18:11:06 -07:00
|
|
|
pkexec /usr/bin/waydroid-container-start
|
2023-10-01 15:57:19 -07:00
|
|
|
if [ -z "$(pgrep weston)" ]; then
|
2023-10-02 11:04:21 -07:00
|
|
|
/usr/bin/weston --socket=weston-waydroid --width=${WAYDROID_WIDTH} --height=${WAYDROID_HEIGHT} &> /dev/null &
|
2023-10-01 15:57:19 -07:00
|
|
|
fi
|
|
|
|
|
2023-10-02 21:04:40 -07:00
|
|
|
# Launch Waydroid
|
2023-10-01 15:57:19 -07:00
|
|
|
sleep 2 &&
|
|
|
|
export XDG_SESSION_TYPE='wayland'
|
2023-10-02 11:04:21 -07:00
|
|
|
export WAYLAND_DISPLAY='weston-waydroid'
|
|
|
|
/usr/bin/waydroid $@ &
|
2023-10-02 21:04:40 -07:00
|
|
|
|
|
|
|
# Fix controllers, we know Waydroid has started because surfaceflinger is running
|
|
|
|
while [ "" == "$(pgrep surfaceflinger)" ]; do
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
pkexec /usr/bin/waydroid-fix-controllers
|
|
|
|
|
|
|
|
# Waydroid is now live!
|
|
|
|
# Wait for exit and then clean up
|
|
|
|
while [ -n "$(pgrep weston)" ]; do
|
2023-10-01 15:57:19 -07:00
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
2023-10-01 18:11:06 -07:00
|
|
|
pkexec /usr/bin/waydroid-container-stop
|