mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 13:55:58 +00:00
* Add your own apps to the Desktop page An Add tile on Desktop takes a .sh script, an AppImage, a GitHub repo (newest ARM64 AppImage release) or a Flatpak ID, with an optional name and icon. Script folders are linked into the session, or copied when they hold Linux programs (shared storage is noexec); folders outside internal storage are bound at their own path. Each app's page opens it under gamescope, edits its name and icon (with icons suggested from its GitHub repo), checks a GitHub app for a newer release and updates it in place, or removes it. Replaces the beta AppImages section. * Put Add at the end of the installable emulators Installed emulators and added apps keep the top section, shown once there is one. Add closes the installable grid, or the installed one when nothing is left to install. * Import DwarFS AppImages and their SVG icons uruntime images built with sharun keep one program under several names as hard links, which Android denies apps, so dwarfsextract aborted. The extraction runs with proot's link2symlink, and each linked name becomes a file of its own afterwards; their AppDir is followed through the squashfs-root link. An image's icon is a PNG of at least 128 px from the name its entry gives, else its SVG (drawn with AndroidSVG), else the largest PNG, else .DirIcon. * Give AppImages the session's pads sharun images start the app through their own ld.so, patched not to read /etc/ld.so.preload, and drop LD_PRELOAD unless allowed, so the app never loaded libfakeinput and saw no controller. The launcher now hands the preload list over in LD_PRELOAD with SHARUN_ALLOW_LD_PRELOAD set. Pad defaults also put Player 1 on the controller for yuzu-family emulators, once, while it is still on the keyboard. * Redesign the Add and Edit app dialogs Source and appearance sit in two panels side by side, with a live preview of the Desktop tile. A disabled primary button keeps an outline so it still reads as a button.
70 lines
3.2 KiB
Bash
Executable File
70 lines
3.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# An AppImage imported from the front end (AppImageManager), extracted once at import into
|
|
# /opt/appimages/user/<id>/app
|
|
# and started from there: proot has no FUSE to mount the image, and extracting it at every
|
|
# start (APPIMAGE_EXTRACT_AND_RUN) would cost the whole image in /tmp each time.
|
|
# bannerlator-appimage-run /opt/appimages/user/<id> [args...]
|
|
set -u
|
|
dir=${1:?usage: bannerlator-appimage-run <imported AppImage directory> [args...]}
|
|
shift
|
|
export APPDIR=$dir/app
|
|
# APPIMAGE is left unset on purpose: with it an app believes it runs from an image file and offers
|
|
# to add itself to the menu (DuckStation) or update the file in place - DroidDeck already does the
|
|
# one, and there is no image file for the other.
|
|
unset APPIMAGE
|
|
export ARGV0=$(cat "$dir/name" 2>/dev/null || basename "$dir")
|
|
if [ ! -x "$APPDIR/AppRun" ]; then
|
|
echo "bannerlator-appimage-run: $APPDIR/AppRun is missing; import the AppImage again" >&2
|
|
exit 127
|
|
fi
|
|
# Browsers sandbox their own children with namespaces and a setuid helper, neither of which proot
|
|
# can give them (the Flatpak sandboxes get the same; see BwrapSpawner): Firefox and its forks (Zen,
|
|
# LibreWolf) by these switches, Electron and Chromium builds by --no-sandbox. Chromium on Wayland
|
|
# also asks the render node for a DRM version KGSL cannot give, so with an X server up it stays on
|
|
# X11, which it picks from the session type.
|
|
export MOZ_DISABLE_CONTENT_SANDBOX=1 MOZ_DISABLE_GMP_SANDBOX=1 MOZ_DISABLE_RDD_SANDBOX=1
|
|
export MOZ_DISABLE_SOCKET_PROCESS_SANDBOX=1 MOZ_DISABLE_UTILITY_SANDBOX=1
|
|
# sharun images start the app through their own ld.so, patched not to read /etc/ld.so.preload, and
|
|
# drop LD_PRELOAD unless allowed: without this the app never gets the session's pads.
|
|
if [ -s /etc/ld.so.preload ]; then
|
|
preload=$(tr -s '\n' ':' < /etc/ld.so.preload)
|
|
export LD_PRELOAD="${preload%:}${LD_PRELOAD:+:$LD_PRELOAD}" SHARUN_ALLOW_LD_PRELOAD=1
|
|
fi
|
|
flags=()
|
|
if [ -e "$APPDIR/chrome-sandbox" ] || compgen -G "$APPDIR/*/chrome-sandbox" >/dev/null; then
|
|
flags+=(--no-sandbox)
|
|
if [ -n "${DISPLAY:-}" ]; then
|
|
export XDG_SESSION_TYPE=x11
|
|
unset WAYLAND_DISPLAY
|
|
flags+=(--ozone-platform=x11)
|
|
fi
|
|
fi
|
|
echo "== appimage $ARGV0 ($APPDIR) ${flags[*]}"
|
|
cd "$APPDIR" || exit 1
|
|
# Apps expect a session bus; Electron's main process traps (SIGTRAP) on an address it cannot
|
|
# parse. A run mode has none, so one is started for the app, as for Flatpak apps.
|
|
case ${DBUS_SESSION_BUS_ADDRESS:-} in
|
|
unix:*) "$APPDIR/AppRun" "${flags[@]}" "$@" ;;
|
|
*) unset DBUS_SESSION_BUS_ADDRESS
|
|
if command -v dbus-run-session >/dev/null 2>&1; then
|
|
dbus-run-session -- "$APPDIR/AppRun" "${flags[@]}" "$@"
|
|
else
|
|
"$APPDIR/AppRun" "${flags[@]}" "$@"
|
|
fi ;;
|
|
esac
|
|
rc=$?
|
|
# The program a session was started for may hand over to another process and exit: Electron apps
|
|
# relaunch themselves (Obsidian on its first start), launchers fork their real program. The
|
|
# session ends with this script, and takes the rest with it - so it waits while anything running
|
|
# from the image is still up.
|
|
image_running() {
|
|
local p exe
|
|
for p in /proc/[0-9]*; do
|
|
exe=$(readlink "$p/exe" 2>/dev/null) || continue
|
|
case $exe in "$APPDIR"/*) return 0 ;; esac
|
|
done
|
|
return 1
|
|
}
|
|
while image_running; do sleep 2; done
|
|
exit $rc
|