Skip to content

Commit

Permalink
umu_runtime: fix format of shim file
Browse files Browse the repository at this point in the history
- Using a docstring created resulted in each line having a leading space character. Instead, prefer to create individual strings and concat them
  • Loading branch information
R1kaB3rN committed Nov 14, 2024

Verified

This commit was signed with the committer’s verified signature.
thornomad Damon Timm
1 parent aaf2b26 commit 13e25f1
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions umu/umu_runtime.py
Original file line number Diff line number Diff line change
@@ -47,27 +47,28 @@ def create_shim(file_path: Path | None = None):
# Set the default path if none is provided
if file_path is None:
file_path = UMU_LOCAL.joinpath("umu-shim")

# Define the content of the shell script
script_content = """#!/bin/sh
if [ "${XDG_CURRENT_DESKTOP}" = "gamescope" ] || [ "${XDG_SESSION_DESKTOP}" = "gamescope" ]; then
# Check if STEAM_MULTIPLE_XWAYLANDS is set to 1
if [ "${STEAM_MULTIPLE_XWAYLANDS}" = "1" ]; then
# Check if DISPLAY is set, if not, set it to ":1"
if [ -z "${DISPLAY}" ]; then
export DISPLAY=":1"
fi
fi
fi
# Execute the passed command
"$@"
# Capture the exit status
status=$?
echo "Command exited with status: $status" >&2
exit $status
"""
script_content = (
"#!/bin/sh\n"
'if [ "${XDG_CURRENT_DESKTOP}" = "gamescope" ] || [ "${XDG_SESSION_DESKTOP}" = "gamescope" ]; then\n'
" # Check if STEAM_MULTIPLE_XWAYLANDS is set to 1\n"
' if [ "${STEAM_MULTIPLE_XWAYLANDS}" = "1" ]; then\n'
' # Check if DISPLAY is set, if not, set it to ":1"\n'
' if [ -z "${DISPLAY}" ]; then\n'
' export DISPLAY=":1"\n'
" fi\n"
" fi\n"
"fi\n"
"\n"
"# Execute the passed command\n"
'"$@"\n'
"\n"
"# Capture the exit status\n"
"status=$?\n"
'echo "Command exited with status: $status" >&2\n'
"exit $status\n"
)

# Write the script content to the specified file path
with file_path.open('w') as file:

0 comments on commit 13e25f1

Please sign in to comment.