mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-11 11:01:07 +00:00
* Run programs, scripts and AppImages from the desktop Windows programs open with the Proton Steam has chosen, and a Steam game's own launch program is handed to Steam. x86-64 Linux programs and game scripts run under FEX, and an exec the kernel refuses goes to droiddeck-open through libblsession's binfmt.c. Programs on noexec shared storage pass KIO's checks; a folder of Linux programs there, and sharun AppImages, are added by the app once and run from the copy. Executable scripts run without KIO's prompt, mpv plays on the software desktop, FEXServer's socket moves under XDG_RUNTIME_DIR, and Proton runtimes no longer show up as games. * Switch to Desktop from Big Picture without Deck mode Big Picture's Switch to Desktop asks the client's SteamOS manager, which the client only has when started as SteamOS (Deck mode). Without it the request failed and the screen stayed on "Switching to Desktop..." for good. The live compat helper now sees the request on its way to the client and hands it to steamos-session-select, which opens the KDE desktop as Deck mode already did. * Run x86 programs from shared storage where they lie FEX asks for the guest's PROT_EXEC when it maps a program or library, which the kernel refuses on noexec shared storage; FEX never runs those pages itself, so libblsession maps them without it in FEX's processes. An x86 game, its libraries and its start script now run in place instead of being copied in; only native code on noexec storage is still copied. A Steam library's games are never copied, and a Linux game's launch program opened from the desktop goes to Steam like a Windows one.
53 lines
2.0 KiB
Bash
Executable File
53 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# A script added on the Desktop page (UserApps), run from its own folder:
|
|
# droiddeck-script-run /opt/droiddeck-apps/<id> [args...]
|
|
set -u
|
|
dir=${1:?usage: droiddeck-script-run <added app directory> [args...]}
|
|
shift
|
|
entry=$(cat "$dir/entry" 2>/dev/null) || { echo "droiddeck-script-run: $dir has no entry" >&2; exit 127; }
|
|
cd -P "$dir/files" 2>/dev/null || { echo "droiddeck-script-run: $dir/files is missing; add the script again" >&2; exit 127; }
|
|
folder=$PWD
|
|
# Shared storage is noexec, so the script is handed to its interpreter rather than executed.
|
|
first=
|
|
IFS= read -r first < "$entry"
|
|
first=${first%$'\r'}
|
|
interp=(/bin/bash)
|
|
# A program as the entry (the desktop's copy of a game's folder) runs itself.
|
|
case $first in '#!'*) read -r -a interp <<< "${first#'#!'}" ;; $'\x7f'ELF*) interp=() ;; esac
|
|
fex=$(cat "$dir/fex" 2>/dev/null)
|
|
case $fex in on|off) ;; *) fex=auto ;; esac
|
|
run=("${interp[@]}" "./$entry")
|
|
if [ -x /usr/local/bin/droiddeck-fex ]; then
|
|
run=(/usr/local/bin/droiddeck-fex run --mode "$fex" --for "$folder" -- "${interp[@]}" "./$entry")
|
|
fi
|
|
echo "== script $entry in $folder (${interp[*]:-a program}, FEX $fex)"
|
|
case ${DBUS_SESSION_BUS_ADDRESS:-} in
|
|
unix:*) "${run[@]}" "$@" ;;
|
|
*) unset DBUS_SESSION_BUS_ADDRESS
|
|
if command -v dbus-run-session >/dev/null 2>&1; then
|
|
dbus-run-session -- "${run[@]}" "$@"
|
|
else
|
|
"${run[@]}" "$@"
|
|
fi ;;
|
|
esac
|
|
rc=$?
|
|
# A launcher script often starts the game and returns; the session lasts while it runs.
|
|
running() {
|
|
local p exe arg cwd
|
|
for p in /proc/[0-9]*; do
|
|
exe=$(readlink "$p/exe" 2>/dev/null) || continue
|
|
case $exe in "$folder"/*) return 0 ;; esac
|
|
case $exe in
|
|
*/FEX|*/FEXInterpreter)
|
|
arg=$(tr '\0' '\n' < "$p/cmdline" 2>/dev/null | sed -n 2p)
|
|
cwd=$(readlink "$p/cwd" 2>/dev/null)
|
|
case $arg in "$folder"/*) return 0 ;; esac
|
|
case $cwd in "$folder"|"$folder"/*) return 0 ;; esac
|
|
;;
|
|
esac
|
|
done
|
|
return 1
|
|
}
|
|
while running; do sleep 2; done
|
|
exit $rc
|