mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-03-28 08:37:12 +00:00
feat(waydroid): Add script to fix controllers in Waydroid
This commit is contained in:
parent
afd20b67e6
commit
2792919ca9
3
system_files/desktop/shared/usr/bin/waydroid-fix-controllers
Executable file
3
system_files/desktop/shared/usr/bin/waydroid-fix-controllers
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
sudo sh -c 'for i in $(seq 7 9); do echo add > /sys/class/input/event$i/uevent; done'
|
@ -2,23 +2,35 @@
|
||||
|
||||
source /etc/default/waydroid-launcher
|
||||
|
||||
# Kill any previous remnants
|
||||
if [ "$(systemctl is-active waydroid-container.service)" == 'active' ]; then
|
||||
killall -9 weston
|
||||
pkexec /usr/bin/waydroid-container-stop
|
||||
exit
|
||||
fi
|
||||
|
||||
# Launch Weston
|
||||
killall -9 weston
|
||||
pkexec /usr/bin/waydroid-container-start
|
||||
if [ -z "$(pgrep weston)" ]; then
|
||||
/usr/bin/weston --socket=weston-waydroid --width=${WAYDROID_WIDTH} --height=${WAYDROID_HEIGHT} &> /dev/null &
|
||||
fi
|
||||
|
||||
# Launch Waydroid
|
||||
sleep 2 &&
|
||||
export XDG_SESSION_TYPE='wayland'
|
||||
export WAYLAND_DISPLAY='weston-waydroid'
|
||||
/usr/bin/waydroid $@ &
|
||||
while [ -n "$(pgrep weston)" ];do
|
||||
|
||||
# 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
|
||||
sleep 1
|
||||
done
|
||||
|
||||
|
@ -29,3 +29,14 @@
|
||||
</action>
|
||||
</policyconfig>
|
||||
|
||||
<action id="org.bazzite.policykit.waydroid.fix.controllers">
|
||||
<description>Fix Controllers in Waydroid</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-fix-controllers</annotate>
|
||||
</action>
|
||||
</policyconfig>
|
||||
|
@ -1,6 +1,7 @@
|
||||
polkit.addRule(function(action, subject) {
|
||||
if ((action.id == "org.bazzite.policykit.waydroid.container.start" ||
|
||||
action.id == "org.bazzite.policykit.waydroid.container.stop") &&
|
||||
action.id == "org.bazzite.policykit.waydroid.container.stop" ||
|
||||
action.id == "org.bazzite.policykit.waydroid.fix.controllers") &&
|
||||
subject.isInGroup("wheel")) {
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user