1
0
mirror of https://github.com/ublue-os/bazzite.git synced 2025-03-20 19:21:20 +00:00

feat: Add Weston launcher for Waydroid using policykit to start and stop service

This commit is contained in:
Kyle Gospodnetich 2023-10-01 15:57:19 -07:00
parent 19a87715ba
commit 7a6085e7df
5 changed files with 64 additions and 0 deletions
system_files/desktop/shared/usr

@ -0,0 +1,3 @@
#!/usr/bin/env bash
sudo systemctl start waydroid-container.service

@ -0,0 +1,3 @@
#!/usr/bin/env bash
sudo systemctl stop waydroid-container.service

@ -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

@ -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>