diff --git a/.devcontainer/.dockerignore b/.devcontainer/.dockerignore new file mode 100644 index 0000000..7639f73 --- /dev/null +++ b/.devcontainer/.dockerignore @@ -0,0 +1,13 @@ +!poetry.lock +!pyproject.toml +.cache +.devcontainer +.git +.gitignore +.pytest_cache +.tool-versions +.venv +.vscode +**/__pycache__ +Dockerfile* +README.md diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..1097724 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,136 @@ +# syntax=docker/dockerfile:1.6 + +# full semver just for python base image +ARG PYTHON_VERSION=3.11.4 + +FROM python:${PYTHON_VERSION}-slim-bullseye AS builder + +# avoid stuck build due to user prompt +ARG DEBIAN_FRONTEND=noninteractive + +# update apt repos and install dependencies +RUN apt -qq update && apt -qq install \ + --no-install-recommends -y \ + curl \ + gcc \ + libpq-dev \ + python3-dev \ + && rm -rf /var/lib/apt/lists/* + +# pip env vars +ENV PIP_NO_CACHE_DIR=off +ENV PIP_DISABLE_PIP_VERSION_CHECK=on +ENV PIP_DEFAULT_TIMEOUT=100 + +# poetry env vars +ENV POETRY_HOME="/opt/poetry" +ENV POETRY_VERSION=1.5.1 +ENV POETRY_VIRTUALENVS_IN_PROJECT=true +ENV POETRY_NO_INTERACTION=1 + +# path +ENV VENV="/opt/venv" +ENV PATH="$POETRY_HOME/bin:$VENV/bin:$PATH" + +COPY requirements.txt requirements.txt + +RUN python -m venv $VENV \ + && . "${VENV}/bin/activate"\ + && python -m pip install "poetry==${POETRY_VERSION}" \ + && python -m pip install -r requirements.txt + +FROM python:${PYTHON_VERSION}-slim-bullseye AS runner + +# setup standard non-root user for use downstream +ENV USER_NAME=appuser +ENV USER_GROUP=appuser +ENV HOME="/home/${USER_NAME}" +ENV HOSTNAME="${HOST:-localhost}" +ENV VENV="/opt/venv" + +ENV PATH="${VENV}/bin:${VENV}/lib/python${PYTHON_VERSION}/site-packages:/usr/local/bin:${HOME}/.local/bin:/bin:/usr/bin:/usr/share/doc:$PATH" + +# standardise on locale, don't generate .pyc, enable tracebacks on seg faults +ENV LANG C.UTF-8 +ENV LC_ALL C.UTF-8 +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONFAULTHANDLER 1 + +# workers per core +# https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker/blob/master/README.md#web_concurrency +ENV WEB_CONCURRENCY=2 + +# avoid stuck build due to user prompt +ARG DEBIAN_FRONTEND=noninteractive + +# install dependencies +RUN apt -qq update && apt -qq install \ + --no-install-recommends -y \ + bat \ + curl \ + dpkg \ + git \ + iputils-ping \ + lsof \ + p7zip \ + perl \ + shellcheck \ + tldr \ + tree \ + && rm -rf /var/lib/apt/lists/* + +RUN groupadd $USER_NAME \ + && useradd -m $USER_NAME -g $USER_GROUP + +# create read/write dirs +RUN < /dev/null +apt update && apt install gh -y +apt remove dpkg -y +rm -rf /var/lib/apt/lists/* + +# fzf +git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf +yes | ~/.fzf/install +EOF + +# qol: .bashrc +RUN tee -a $HOME/.bashrc </**" + ], + // "runtimeExecutable": "${env:HOME}/.n/bin/node" + } + ], + "ansible.python.interpreterPath": "${workspaceFolder}/.venv/bin/python" +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..eb2f393 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,14 @@ +{ + "[python]": { + "editor.insertSpaces": true, + "editor.tabSize": 4, + }, + "python.testing.pytestArgs": [ + "." + ], + // ! only disable analysis (pylance) if ruff is installed + // https://github.com/astral-sh/ruff-vscode + // "python.analysis.ignore": [ + // "*" + // ], +} diff --git a/README.md b/README.md index 0e31800..fb4336b 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,14 @@

+

NonSteamLaunchers 🚀

This script installs the latest GE-Proton, installs NonSteamLaunchers under one unique Proton prefix folder in your compatdata folder path called "NonSteamLaunchers" and adds them to your Steam Library. So you can use them on Desktop or in Game Mode. +

Features ✅

@@ -54,10 +56,11 @@ Supported Streaming Sites for games and as well as any website. 🌐

Find Games

+ Use the "Find Games" button to load [Boilr](https://github.com/PhilipK/BoilR) this will open Boilr for you to set your settings so you can find your games easier.

-How to Install🔧 +How to Install 🔧

@@ -65,11 +68,12 @@ How to Install🔧

-+ Go to desktop mode, right click the download button above and save the .desktop file to your Steam Deck desktop. -+ Go to your desktop, click the NonSteamLaunchers icon, it will download and run the latest NonSteamLaunchers.sh from this repository and run it. -+ You will simply have to choose which launcher to install and let the script handle the rest. 💻 No files are left in your "Downloads" they are deleted after installation. -+ After running the script, launch Steam on your Steam Deck. You'll find the new launchers in your library under the non-steam tab. Click a launcher to see your installed games from that store, and launch them directly from Steam! Even in gamemode 🥳 +* Go to desktop mode, right click the download button above and save the .desktop file to your Steam Deck desktop. +* Go to your desktop, click the NonSteamLaunchers icon, it will download and run the latest NonSteamLaunchers.sh from this repository and run it. +* You will simply have to choose which launcher to install and let the script handle the rest. 💻 No files are left in your "Downloads" they are deleted after installation. +* After running the script, launch Steam on your Steam Deck. You'll find the new launchers in your library under the non-steam tab. Click a launcher to see your installed games from that store, and launch them directly from Steam! Even in gamemode 🥳 +

▶️ YouTube Tutorial 🡺🡺🡺 https://www.youtube.com/watch?v=svOj4MTEAVc 🡸🡸🡸 ▶️ @@ -89,21 +93,111 @@ How to Uninstall 🗑 Currently Working On 👷‍♂️ -- Decky Loader Plugin ❌ -- Auto-download images and set them for library entries ❌ -- Integrate better with [BoilR](https://github.com/PhilipK/BoilR) ❌ -# +* Decky Loader Plugin ❌ +* Auto-download images and set them for library entries ❌ +* Integrate better with [BoilR](https://github.com/PhilipK/BoilR) ❌

Contributing 🤝

If you have any suggestions or improvements for this script, feel free to open an issue or submit a pull request. -You can donate me on [ko-fi](https://ko-fi.com/moraroy), [liberapay](https://liberapay.com/moraroy) or [sponsor me on github](https://github.com/sponsors/moraroy) + +You can donate to me on [ko-fi](https://ko-fi.com/moraroy), [liberapay](https://liberapay.com/moraroy), or [sponsor me on github](https://github.com/sponsors/moraroy) + +## Development Environment + +### Dev Container + +Install [Docker](https://docs.docker.com/compose/install/). Once installed, a clean dev environment with a Docker container [native to VSCode](https://code.visualstudio.com/docs/devcontainers/create-dev-container#_dockerfile) is spun up automatically. + +* [Command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) (⇧⌘P) > Dev Containers: Reopen in Container +* F5 for debug + * May need to select interpreter (e.g., `/opt/venv/bin/python`) first + +**VSCode Extensions (Dev Container)** + +* [Atom Keymap](https://marketplace.visualstudio.com/items?itemName=ms-vscode.atom-keybindings) +* [Bash IDE](https://marketplace.visualstudio.com/items?itemName=mads-hartmann.bash-ide-vscode) +* [Better Comments](https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments) +* [Docker](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker) +* [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) +* [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) +* [GitHub Copilot Chat](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat) +* [gitignore](https://marketplace.visualstudio.com/items?itemName=codezombiech.gitignore) +* [GitLens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens) +* [Markdown All in One](https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one) +* [MS Visual Studio Live Share](https://marketplace.visualstudio.com/items?itemName=MS-vsliveshare.vsliveshare) +* [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) +* [Shellcheck](https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck) + +### Manual Docker Instance + +If VSCode isn't present or only the python portion (cf. `__init__.py`) is being worked on, it's possible to just run a Docker container on its own. The container installs the correct version of python and any dependencies (e.g., ipython, rich) in `requirements.txt`. + +```bash +# navigate to directory with Dockerfile +cd .devcontainer/ + +# build image +docker build -t nonsteamlaunchers . + +# run container +docker run -it --rm --name=mynonsteamlaunchers --workdir=/app -v $(pwd):/app nonsteamlaunchers bash + +# exit container +exit +``` + +### Python virtual environment + +Useful for the python module(s), but extra compared to the [dev container](#dev-container) portion that covers the core shell script. + +```bash +# create virtual environment +python -m venv .venv + +# activate virtual environment +source .venv/bin/activate + +# install dependencies +python -m pip install -r requirements.txt +``` + +### Additional tooling + +Additional tooling includes but is not limited to: + +#### asdf + +* Install [asdf](https://asdf-vm.com/guide/getting-started.html#_2-download-asdf) +* Usage + ```bash + # add python plugin + asdf plugin-add python + + # install stable python + asdf install python + + # set stable to system python + asdf global python latest + + # add poetry asdf plugin + asdf plugin-add poetry https://github.com/asdf-community/asdf-poetry.git + + # install latest version via asdf + asdf install poetry + + # set latest version as default + asdf global poetry latest + ``` + +#### shellcheck + +`.shellcheckrc` excludes various [bash language rules](https://github.com/koalaman/shellcheck/wiki/Ignore#ignoring-one-or-more-types-of-errors-forever). Useful to control noise vs. legitimate warnings/errors when using the shellcheck extension.

License 📝

- This project is licensed under the MIT License. See the `LICENSE` file for more information.