feat: Improve Waydroid launcher, automatically initialize Waydroid if not initialized and use first-launch as a default param

This commit is contained in:
Kyle Gospodnetich 2023-11-01 13:40:01 -07:00
parent d10c15a206
commit 5f5f74d924

View File

@ -7,6 +7,11 @@ if [ "$(systemctl is-active waydroid-container.service)" == 'active' ]; then
pkexec /usr/bin/waydroid-container-stop
fi
# Check if Waydroid is initialized, initialize if not
if grep -qz 'not initialized' <<< $(/usr/bin/waydroid status); then
/usr/bin/ujust init-waydroid
fi
# Launch Weston
killall -9 weston
pkexec /usr/bin/waydroid-container-start
@ -18,7 +23,8 @@ fi
sleep 2 &&
export XDG_SESSION_TYPE='wayland'
export WAYLAND_DISPLAY='weston-waydroid'
/usr/bin/waydroid $@ &
LAUNCH_PARAM=$@
/usr/bin/waydroid ${LAUNCH_PARAM:-first-launch} &
# Fix controllers, we know Waydroid has started because surfaceflinger is running
while [ "" == "$(pgrep surfaceflinger)" ]; do