From 5f5f74d924001350f94fbd0d1fa778a63a88965c Mon Sep 17 00:00:00 2001 From: Kyle Gospodnetich Date: Wed, 1 Nov 2023 13:40:01 -0700 Subject: [PATCH] feat: Improve Waydroid launcher, automatically initialize Waydroid if not initialized and use first-launch as a default param --- system_files/desktop/shared/usr/bin/waydroid-launcher | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/system_files/desktop/shared/usr/bin/waydroid-launcher b/system_files/desktop/shared/usr/bin/waydroid-launcher index fc7a06e07e..65555b9be9 100755 --- a/system_files/desktop/shared/usr/bin/waydroid-launcher +++ b/system_files/desktop/shared/usr/bin/waydroid-launcher @@ -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