misc: uh what happened here

This commit is contained in:
2023-06-11 16:18:20 +07:00
parent bae0d02885
commit d0572325eb
24 changed files with 393 additions and 33 deletions

45
apps/lutris/README.md Normal file
View File

@ -0,0 +1,45 @@
# Lutris scripts
## `preloader.sh`
Execute multiple scripts in a folder (default is `./preloader`), usually useful for Lutris Pre-launch/Post-exit script
+ Logging is enabled by default, but can be disabled by changing DEBUG to 0 in script source (`DEBUG=0`)
> This script will execute scripts in **current working directory** *(where `preloader.sh` is executed)*, so for example if a script need a file called `nightmare`, and preloader.sh is in `~`, **put the file in `~`** *instead of `~/preloader/`*
### Installation
+ To download `preloader.sh` itself:
```sh
curl -OL https://gitlab.com/tretrauit/scripts/-/raw/main/apps/Lutris/preloader.sh
chmod +x preloader.sh
```
+ After that, copy/move this script to the game prefix you want to use, then in Lutris:
- Set pre-launch script in Lutris to where `preloader.sh` is located.
- Disable **Wait for pre-launch script completion** (optional)
+ **IMPORTANT**: Now, to add pre-launch script, instead of setting them in Lutris, add them to `./preloader` (or the folder you specified).
+ Enjoy :L
### Documentation
There are environment variables to control how preloader.sh work:
+ `PRELOADER_PATH=./preloader`: Path to preload scripts.
+ `PRELOADER_DEBUG=0`: Enable debug (1) or disable it (0)
## `discord_rpc.sh`
Launch `winediscordrpcbridge.exe`, to be able to get Discord Rich Presence on Wine applications on the specified prefix.
### Installation
+ To install you must have [`winediscordrpcbridge.exe`](https://github.com/0e4ef622/wine-discord-ipc-bridge/) present, if not you can download latest version by executing
```sh
curl -OL https://github.com/0e4ef622/wine-discord-ipc-bridge/releases/latest/download/winediscordipcbridge.exe
```
or use my build (latest commit: `master/9d56418`)
```sh
curl -OL https://github.com/teppyboy/releases/releases/download/git%2B0e4ef622%2Fwine-discord-ipc-bridge%2Bmaster%2F9d56418/winediscordipcbridge.exe
```
+ Then to download `discord_rpc.sh` itself:
```sh
curl -OL https://gitlab.com/tretrauit/scripts/-/raw/main/apps/Lutris/discord_rpc.sh
chmod +x discord_rpc.sh
```
+ After that, copy/move this script to the game prefix you want to use, then in Lutris:
- Set pre-launch script in Lutris to where `discord_rpc.sh` is located.
- Disable **Wait for pre-launch script completion**
+ Enjoy :L

View File

@ -0,0 +1,6 @@
#!/bin/bash
# Launch winediscordipcbridge.exe automatically.
echo "wine: $WINE"
echo "prefix: $WINEPREFIX"
$WINE ./winediscordipcbridge.exe

View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Put your game process name here (can be full name or short name)
# If it doesn't work for .exe file, try <process name>.e instead
# it may work.
PROCESS=""
echo "Waiting for '$PROCESS' to start..."
until _=$(pidof $PROCESS)
do
sleep 1
done
echo "Starting picom..."
picom --experimental-backends &
picom_pid=$!
echo "picom PID: $picom_pid"
echo "Waiting for '$PROCESS' to exit..."
while [[ $(pidof $PROCESS) ]]; do
sleep .5
done
echo "Killing picom..."
kill -15 $picom_pid
echo "Done."

34
apps/lutris/preloader.sh Normal file
View File

@ -0,0 +1,34 @@
#!/bin/bash
# Lutris pre-loader script, for allowing loading multiple pre-load scripts.
# Enabling debug will enable the script output.
# Folder path (relative to Lutris prefix directory)
FOLDER="${PRELOADER_PATH:-"./preloader"}"
DEBUG="${PRELOADER_DEBUG:-0}"
execute_file () {
# Just in case...
chmod +x "$1"
if [[ $DEBUG -eq 0 ]]; then
nohup "$1" >/dev/null 2>&1 &
else
fullfile="$1"
filename="${fullfile##*/}"
nohup "$1" > ./logs/"$FOLDER"_"$filename".log 2>&1 &
fi
}
if [[ $DEBUG -ne 0 ]]; then
echo "!!!DEBUGGING ENABLED!!!"
echo "Debug log may leak your sensitive information, use with caution."
echo "!!!DEBUGGING ENABLED!!!"
mkdir -p "$FOLDER" ./logs/
fi
echo "Checking directory..."
for file in "$FOLDER"/*.*; do
[ -e "$file" ] || continue
echo "Found $file, loading..."
execute_file "$file"
done