diff --git a/home/stormux/.local/.functions/game_install_functions.sh b/home/stormux/.local/.functions/game_install_functions.sh index 435b150..7e87469 100755 --- a/home/stormux/.local/.functions/game_install_functions.sh +++ b/home/stormux/.local/.functions/game_install_functions.sh @@ -119,6 +119,34 @@ open_url() { env GAME="$targetUrl" startx } +run_install_x_command() { + local quotedCommand="" + + check_dependencies startx + printf -v quotedCommand '%q ' "$@" + quotedCommand="${quotedCommand% }" + + env DISPLAY="${DISPLAY:-:0}" \ + STORMUX_X_SESSION_MODE=install \ + STORMUX_INSTALL_COMMAND="$quotedCommand" \ + startx +} + +run_wine_headless() { + local commandName="$1" + + shift + command "$commandName" "$@" +} + +wine() { + run_install_x_command command wine "$@" +} + +winetricks() { + run_install_x_command command winetricks "$@" +} + wait_for_enter() { local message="$1" diff --git a/home/stormux/.local/.functions/install_game.sh b/home/stormux/.local/.functions/install_game.sh index 4c9a344..c69c00e 100755 --- a/home/stormux/.local/.functions/install_game.sh +++ b/home/stormux/.local/.functions/install_game.sh @@ -22,8 +22,9 @@ launchRoot="${launchRoot:-${HOME}/.local/.launch}" redownload="${redownload:-false}" ipfsGateway="${ipfsGateway:-https://ipfs.stormux.org}" fex="${fex:-}" +DISPLAY="${DISPLAY:-:0}" -export installPath cache launchRoot redownload ipfsGateway fex gameName game +export installPath cache launchRoot redownload ipfsGateway fex gameName game DISPLAY safe_log_name() { local name="$1" diff --git a/home/stormux/.local/bin/stormux_launch_helpers.sh b/home/stormux/.local/bin/stormux_launch_helpers.sh index 02ce7a4..6f6fd6d 100755 --- a/home/stormux/.local/bin/stormux_launch_helpers.sh +++ b/home/stormux/.local/bin/stormux_launch_helpers.sh @@ -35,6 +35,18 @@ start_screen_reader() { cthulhu & } +run_install_session_command() { + local installCommand="${STORMUX_INSTALL_COMMAND:-}" + + if [[ -z "$installCommand" ]]; then + printf 'Missing STORMUX_INSTALL_COMMAND\n' >&2 + return 1 + fi + + export DISPLAY="${DISPLAY:-:0}" + /bin/bash -lc "$installCommand" +} + check_architecture() { local architecture local supportedArch diff --git a/home/stormux/.xinitrc b/home/stormux/.xinitrc index 8766ac1..380ab6d 100755 --- a/home/stormux/.xinitrc +++ b/home/stormux/.xinitrc @@ -30,6 +30,13 @@ export MESA_GL_VERSION_OVERRIDE=3.2 export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus export DBUS_SESSION_BUS_PID +if [[ "${STORMUX_X_SESSION_MODE:-}" == "install" ]]; then + run_install_session_command + launchStatus=$? + pkill -15 Xorg + exit "$launchStatus" +fi + dwm & xbindkeys