Skip to content

Commit

Permalink
Changes to ensure the weston window is started with same resolution a…
Browse files Browse the repository at this point in the history
…s it will be displayed within pyefis. Also set waydroid height and width properties to match before starting waydroid. Without this waydroid would get disconnected from weston when interacting with the interface. This seems to be a problem when the screen with wydroid is not the default screen and the waydroid screen is only displayed after waydroid has fully booted
  • Loading branch information
e100 committed Jun 17, 2024
1 parent baa19de commit a75c8e6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
26 changes: 24 additions & 2 deletions extras/extras/waydroid_monitor.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

pid=0

weston_pid=0
# Stop waydroid on exit if running
trap "exit" INT TERM
trap "kill 0" EXIT
Expand All @@ -10,12 +10,34 @@ while :
do
if [ -S ${XDG_RUNTIME_DIR}/snap.pyefis/pyefis-waydroid-1 ]; then
if (( pid == 0 )); then
echo "starting waydroid"
cmd=$(ps x|grep weston|grep -v grep|head -n 1)
regex='([0-9]+) .* --width=([0-9]+) --height=([0-9]+) '
if [[ "$cmd" =~ $regex ]]; then
weston_pid=${BASH_REMATCH[1]}
width=${BASH_REMATCH[2]}
height=${BASH_REMATCH[3]}
# Set waydroid resolution to match weston to prevent crash
waydroid prop set persist.waydroid.width ${width}
waydroid prop set persist.waydroid.width ${height}
echo "Set ${width}x${height}"
fi
# Wait a couple seconds to ensure weston is ready
sleep 2
export WAYLAND_DISPLAY=snap.pyefis/pyefis-waydroid-1
waydroid show-full-ui &
pid=$!
else
cmd=$(ps x|grep weston|grep -v grep|head -n 1)
regex='([0-9]+) .*'
if [[ "$cmd" =~ $regex ]]; then
new_weston_pid=${BASH_REMATCH[1]}
if [ $new_weston_pid -ne $weston_pid ]; then
echo "Killing waydroid pid for weston restart: ${pid}"
kill ${pid}
pid=0
weston_pid=$new_weston_pid
fi
fi
fi
else
if (( pid > 0 )); then
Expand Down
2 changes: 1 addition & 1 deletion src/pyefis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "2.0.21"
__version__ = "2.0.22"

4 changes: 2 additions & 2 deletions src/pyefis/screens/screenbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ def setup_instruments(self,count,i,ganged=False,replace=None,state=False):
and 'row' in i \
and 'column' in i:
grid_x, grid_y, grid_width, grid_height = self.get_grid_coordinates( i['column'], i['row'])
weston_width = int(grid_width * i['span']['columns'])
weston_height = int(grid_height * i['span']['rows'])
weston_width = qRound(grid_width * i['span']['columns'])
weston_height = qRound(grid_height * i['span']['rows'])
# span rows/columns are required for weston to work properly and they need to be at least 200px x 200px
self.instruments[count] = weston.Weston(self,socket=i['options']['socket'],ini=os.path.join(self.parent.config_path,i['options']['ini']),command=i['options']['command'],args=i['options']['args'],wide=weston_width,high=weston_height)
else:
Expand Down

0 comments on commit a75c8e6

Please sign in to comment.