Skip to content

Commit

Permalink
make lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
GloriousEggroll committed Oct 22, 2024
1 parent 5ea4c99 commit 2fa822b
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions umu/umu_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,42 @@
has_data_filter: bool = False


def create_shim(file_path=None):
def create_shim(file_path: Optional[Path] = None):

Check failure on line 36 in umu/umu_runtime.py

View workflow job for this annotation

GitHub Actions / build (3.10)

Ruff (F821)

umu/umu_runtime.py:36:28: F821 Undefined name `Optional`
"""Create a shell script shim at the specified file path.
This script sets the DISPLAY environment variable if certain conditions
are met and executes the passed command.
Args:

Check failure on line 42 in umu/umu_runtime.py

View workflow job for this annotation

GitHub Actions / build (3.10)

Ruff (D413)

umu/umu_runtime.py:42:5: D413 Missing blank line after last section ("Args")
file_path (Path, optional): The path where the shim script will be created.
Defaults to UMU_LOCAL.joinpath("umu-shim").
"""
# 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"
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
fi
# Execute the passed command
"$@"
"""
# Execute the passed command
"$@"
"""

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

# Make the script executable
os.chmod(file_path, 0o755)
file_path.chmod(0o700)

def _install_umu(
json: dict[str, Any],
Expand Down

0 comments on commit 2fa822b

Please sign in to comment.