From 66a1088194bb13c2d86d2c0af316b280a7235640 Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Thu, 14 Nov 2024 03:47:22 +0000 Subject: [PATCH] fix: remove leading spaces in shim (#275) * umu_runtime: fix format of shim file - Using a docstring resulted in each line having a leading space character. Instead, prefer to create individual strings and concat them * umu_runtime: add new line in shim --- umu/umu_runtime.py | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/umu/umu_runtime.py b/umu/umu_runtime.py index c68fe469f..8050d3fa1 100644 --- a/umu/umu_runtime.py +++ b/umu/umu_runtime.py @@ -47,27 +47,29 @@ 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" + "\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: