Skip to content

Commit

Permalink
Prepared bookworm support
Browse files Browse the repository at this point in the history
Updated launch script
Removed obsolete patch file
  • Loading branch information
chrishamm committed Dec 14, 2023
1 parent 887f093 commit afb1a41
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 38 deletions.
22 changes: 0 additions & 22 deletions params.diff

This file was deleted.

41 changes: 25 additions & 16 deletions pkg/common/duetwebcontrol/usr/bin/launch-dwc
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,34 @@ while (systemctl -q is-enabled duetwebserver.service) && !(systemctl -q is-activ
sleep 1
done

# Start Chromium
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
chromium-browser --app=http://$(hostname) --app-auto-launched --start-fullscreen --in-process-gpu &
# Start preinstalled browser but prefer Chromium
if [ -x /usr/bin/chromium-browser ]; then
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
chromium-browser --app=http://localhost --app-auto-launched --start-fullscreen &
elif [ -x /usr/bin/firefox ]; then
firefox --kiosk --new-window http://localhost
else
xdg-open http://localhost
fi
pid=$!

# Wait for DWC to be started
while [ -z "$(wmctrl -l | cut -d ' ' -f 5- | grep -e "Duet Web Control" -e "$(hostname)")" ]; do
sleep 1
done
sleep 2
# Focus other windows if wmctrl is preinstalled (not the case on Bookworm)
if [ -x /usr/bin/wmctrl ]; then
# Wait for DWC to be started
while [ -z "$(wmctrl -l | cut -d ' ' -f 5- | grep -e "Duet Web Control" -e "$(hostname)")" ]; do
sleep 1
done
sleep 2

# Focus other windows
wmctrl -l | cut -d ' ' -f 5- | grep -v -e "Duet Web Control" -e "$(hostname)" | while read window; do
if [ ! -z "$window" ]; then
echo "Focusing $window"
wmctrl -R "$window"
fi
done
# Focus other windows
wmctrl -l | cut -d ' ' -f 5- | grep -v -e "Duet Web Control" -e "$(hostname)" | while read window; do
if [ ! -z "$window" ]; then
echo "Focusing $window"
wmctrl -R "$window"
fi
done
fi

# Wait for Chromium to be closed again
wait $pid

0 comments on commit afb1a41

Please sign in to comment.