Skip to content

Instantly share code, notes, and snippets.

@daktak
Last active December 10, 2021 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daktak/937a3db8843623d4a86eb547864fc701 to your computer and use it in GitHub Desktop.
Save daktak/937a3db8843623d4a86eb547864fc701 to your computer and use it in GitHub Desktop.
Execute Zwift via cli (lutris)
#!/bin/bash
xset s off # don't activate screensaver
xset -dpms # disable DPMS (Energy Star) features.
xset s noblank # don't blank the video device
USER=`whoami`
PATH=/home/${USER}/Games/zwift
GAME_LOCATION="${PATH}/drive_c/Program Files (x86)/Zwift"
RUNNER=lutris-fshack-6.21-6-x86_64
export WINEPREFIX=${PATH} wine
export WINEESYNC=1
export WINE=/home/${USER}/.local/share/lutris/runners/wine/${RUNNER}/bin/wine
export DXVK_STATE_CACHE_PATH=${PATH}
export __GL_SHADER_DISK_CACHE_PATH=${PATH}
export SDL_VIDEO_FULLSCREEN_DISPLAY=off
export WINEARCH=win64
export WINE_LARGE_ADDRESS_AWARE=1
export game_name='zwift'
export WINEDLLOVERRIDES='api-ms-win-crt-private-l1-1-0,ucrtbase=n,b;d3d10,d3d10_1,d3d10core,d3d11,dxgi=n;d3d12,nvapi,nvapi64='
GAME_EXECUTABLE='RunFromProcess-x64.exe'
GAME_ARGS='ZwiftLauncher.exe ZwiftApp.exe'
cd "${GAME_LOCATION}"
"$WINE" ZwiftLauncher.exe > /dev/null 2>&1 &
cd "${PATH}"
"$WINE" $GAME_EXECUTABLE $GAME_ARGS "$@" > /dev/null 2>&1
@daktak
Copy link
Author

daktak commented Dec 10, 2021

You can execute with below if you want as a session

#!/bin/bash
zwift.sh &
PID=`pidof "C:\Program Files (x86)\Zwift\ZwiftLauncher.exe"`
while [[ -z $PID ]]; do
    sleep 5
    PID=`pidof "C:\Program Files (x86)\Zwift\ZwiftLauncher.exe"`
    echo no launcher
done
while [[ -n $PID ]]; do
    sleep 5
    echo kill $PID
    kill -9 $PID
    PID=`pidof "C:\Program Files (x86)\Zwift\ZwiftLauncher.exe"`
done
PID=`pidof ZwiftApp.exe`
while [[ -n $PID ]]; do
    echo app $PID
    sleep 5
    PID=`pidof ZwiftApp.exe`
done
killall -9 winedevice.exe
killall -9 wineserver


[Desktop Entry]
Name=zwift
Comment=cycling app
Exec=zwift_launch.sh
TryExec=zwift_launch.sh
Type=Application
X-LightDM-DesktopName=zwift
DesktopNames=zwift
Keywords=tiling;wm;windowmanager;window;manager;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment