Skip to content

Commit

Permalink
feat: Add Weston launcher for Waydroid using policykit to start and s…
Browse files Browse the repository at this point in the history
…top service
  • Loading branch information
KyleGospo committed Oct 1, 2023
1 parent 19a8771 commit 7a6085e
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
3 changes: 3 additions & 0 deletions system_files/desktop/shared/usr/bin/waydroid-container-start
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

sudo systemctl start waydroid-container.service
3 changes: 3 additions & 0 deletions system_files/desktop/shared/usr/bin/waydroid-container-stop
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

sudo systemctl stop waydroid-container.service
25 changes: 25 additions & 0 deletions system_files/desktop/shared/usr/bin/waydroid-launcher
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

source /etc/default/waydroid-launcher

if [ "$(systemctl is-active waydroid-container.service)" == 'active' ]; then
killall -9 weston
pkexec /usr/bin/stop-waydroid-container
exit
fi

killall -9 weston
pkexec /usr/bin/start-waydroid-container
if [ -z "$(pgrep weston)" ]; then
/usr/bin/weston --xwayland --width="${WAYDROID_WIDTH}" --height="${WAYDROID_HEIGHT}" &> /dev/null &
fi

sleep 2 &&
export XDG_SESSION_TYPE='wayland'
export DISPLAY=':1'
/usr/bin/waydroid show-full-ui &
while [ -n "$(pgrep weston)" ];do
sleep 1
done

pkexec /usr/bin/stop-waydroid-container
2 changes: 2 additions & 0 deletions system_files/desktop/shared/usr/etc/default/waydroid-launcher
@@ -0,0 +1,2 @@
WAYDROID_WIDTH=1280
WAYDROID_HEIGHT=800
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<vendor>Bazzite</vendor>
<vendor_url>https://bazzite.gg</vendor_url>

<action id="org.bazzite.policykit.waydroid.container.start">
<description>Start Waydroid Container</description>
<icon_name>package-x-generic</icon_name>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/waydroid-container-start</annotate>
</action>

<action id="org.bazzite.policykit.waydroid.container.stop">
<description>Stop Waydroid Container</description>
<icon_name>package-x-generic</icon_name>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/waydroid-container-stop</annotate>
</action>
</policyconfig>

0 comments on commit 7a6085e

Please sign in to comment.