netbrain / zwift

Easily zwift on linux
The Unlicense
265 stars 28 forks source link

Add support for wayland #14

Closed netbrain closed 1 year ago

netbrain commented 1 year ago

In issue #13 it seems that the Zwift startup script doesnt support Wayland. Implement support for running Zwift under Wayland.

nikolaus-stahlberg commented 1 year ago

Just FYI I have been able to get this running under wayland using debian-testing (should roughly correspond to the upcoming bookworm release at the moment) without changing much.

I simply cloned the image and used the docker run command from the README. All I had to do is remove the --gpus argument, as docker complained about it, and Zwift started in a big screen filling window.

So I ended up running:

sudo docker run --privileged --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /run/user/$UID/pulse:/run/user/1000/pulse netbrain/zwift:latest

and all was well.

So not much info really, just wanted to let you know I got it running under wayland.

MailFranzel commented 1 year ago

I am using Fedora 38 ! This works for me!! Is there a possiblity to save the Login-Data, Settings and so on ..

netbrain commented 1 year ago

Try removing the following In zwift.sh file?

VGA_DEVICE_FLAG="--gpus all"

On Wed, Jun 28, 2023, 20:42 MailFranzel @.***> wrote:

I am using Fedora 38 ! This works for me!! Is there a possiblity to save the Login-Data, Settings and so on ..

— Reply to this email directly, view it on GitHub https://github.com/netbrain/zwift/issues/14#issuecomment-1611905045, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACTNCYKY2A4ADLMAXDRVWTXNR3IVANCNFSM6AAAAAAUM5QZWU . You are receiving this because you authored the thread.Message ID: @.***>

MailFranzel commented 1 year ago

I use the command from above. There is no line VGA_DEVICE_FLAG sudo docker run \ --privileged \ --rm \ -e DISPLAY=$DISPLAY \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -v /run/user/$UID/pulse:/run/user/1000/pulse \ netbrain/zwift:latest This works fine!

netbrain commented 1 year ago

https://github.com/netbrain/zwift/blob/master/zwift.sh

MailFranzel commented 1 year ago

--> https://github.com/netbrain/zwift/blob/master/zwift.sh This does not work for me ... ./zwift.sh Trying to pull docker.io/netbrain/zwift:latest... Getting image source signatures Copying blob 4fd48bd53e92 skipped: already exists Copying blob 4fd48bd53e92 skipped: already exists Copying blob 6a8e85d4c029 skipped: already exists Copying blob f33fc64d6f5f skipped: already exists Copying blob 5b8daee867fc skipped: already exists Copying blob f4ed1725fe5d skipped: already exists Copying blob 74231d2f3d98 skipped: already exists Copying blob 78186c174e8a skipped: already exists Copying blob 776dc80fd81e skipped: already exists Copying blob 0ae84cf7da67 skipped: already exists Copying blob ec6d0a5d1a24 skipped: already exists Copying blob ed5bf646b5ca skipped: already exists Copying blob 7ce8d4dd0c87 skipped: already exists Copying blob 691c252dc105 skipped: already exists Copying blob 6da3bc9a7562 skipped: already exists Copying blob 51acfe6cc131 skipped: already exists Copying blob 66e80bab9dd5 skipped: already exists Copying blob 6b2a34a89de6 skipped: already exists Copying blob 5eb5b503b376 skipped: already exists Copying blob a04531ea5940 skipped: already exists Copying blob 87dc1f3134b4 skipped: already exists Copying blob 980e352708d7 skipped: already exists Copying blob ae17a21221c4 skipped: already exists Copying blob f8cd0159113b skipped: already exists Copying blob 433765c06f64 skipped: already exists Copying config bb43a15a59 done Writing manifest to image destination Storing signatures bb43a15a59df730e19751b4d80ef218fc6576ef4982d70335f33b953debba8d8 non-network local connections being added to access control list But the script from nikolaus-stahlberg is running, but without saving data

netbrain commented 1 year ago

Try adding this to the command you are running

-v $ZWIFT_HOME:/home/user/Zwift

ZWIFTHOME being the path you want to store the data

On Fri, Jun 30, 2023, 17:23 MailFranzel @.***> wrote:

--> https://github.com/netbrain/zwift/blob/master/zwift.sh This does not work for me ... ./zwift.sh Trying to pull docker.io/netbrain/zwift:latest... Getting image source signatures Copying blob 4fd48bd53e92 skipped: already exists Copying blob 4fd48bd53e92 skipped: already exists Copying blob 6a8e85d4c029 skipped: already exists Copying blob f33fc64d6f5f skipped: already exists Copying blob 5b8daee867fc skipped: already exists Copying blob f4ed1725fe5d skipped: already exists Copying blob 74231d2f3d98 skipped: already exists Copying blob 78186c174e8a skipped: already exists Copying blob 776dc80fd81e skipped: already exists Copying blob 0ae84cf7da67 skipped: already exists Copying blob ec6d0a5d1a24 skipped: already exists Copying blob ed5bf646b5ca skipped: already exists Copying blob 7ce8d4dd0c87 skipped: already exists Copying blob 691c252dc105 skipped: already exists Copying blob 6da3bc9a7562 skipped: already exists Copying blob 51acfe6cc131 skipped: already exists Copying blob 66e80bab9dd5 skipped: already exists Copying blob 6b2a34a89de6 skipped: already exists Copying blob 5eb5b503b376 skipped: already exists Copying blob a04531ea5940 skipped: already exists Copying blob 87dc1f3134b4 skipped: already exists Copying blob 980e352708d7 skipped: already exists Copying blob ae17a21221c4 skipped: already exists Copying blob f8cd0159113b skipped: already exists Copying blob 433765c06f64 skipped: already exists Copying config bb43a15a59 done Writing manifest to image destination Storing signatures bb43a15a59df730e19751b4d80ef218fc6576ef4982d70335f33b953debba8d8 non-network local connections being added to access control list But the script from nikolaus-stahlberg is running, but without saving data

— Reply to this email directly, view it on GitHub https://github.com/netbrain/zwift/issues/14#issuecomment-1614814221, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACTNCZNEWGY5UH6L235IVLXN3VQXANCNFSM6AAAAAAUM5QZWU . You are receiving this because you authored the thread.Message ID: @.***>

MailFranzel commented 1 year ago

I inserted -v /home/martin/.zwift:/home/user/Zwift and it is storing the data! Thanks! But I still can not use your batch script. I have use the script from Nikolaus Stahlberg , with one extra: I have to call xhost +local:root before calling the docker.

quietvoid commented 1 year ago

Personally I run the script in Sway (amdgpu) and it works perfectly fine with this diff. No issue so far. The Zwift window is running in XWayland.

diff --git a/zwift.sh b/zwift.sh
index 12f23f0..e594b83 100755
--- a/zwift.sh
+++ b/zwift.sh
@@ -1,5 +1,7 @@
 #!/bin/bash +x

+set -e
+
 # Use podman if available
 if [[ -x "$(command -v podman)" ]]
 then
@@ -9,7 +11,7 @@ else
 fi

 # The home directory to store zwift data
-ZWIFT_HOME=${ZWIFT_HOME:-$HOME/.zwift/$USER}
+ZWIFT_HOME=${ZWIFT_HOME:-$HOME/.config/.zwift}

 # Set the container image to use
 IMAGE=${IMAGE:-docker.io/netbrain/zwift}
@@ -19,7 +21,7 @@ VERSION=${VERSION:-latest}

 # Create the zwift home directory if not already exists
 mkdir -p $ZWIFT_HOME
-$CONTAINER_TOOL unshare chown $UID:$UID -R $ZWIFT_HOME
+# $CONTAINER_TOOL unshare chown $UID:$UID -R $ZWIFT_HOME

 # Check for updated container image
 $CONTAINER_TOOL pull $IMAGE:$VERSION
@@ -45,4 +47,4 @@ CONTAINER=$($CONTAINER_TOOL run \
        $IMAGE:$VERSION)

 # Allow container to connect to X
-xhost +local:$($CONTAINER_TOOL inspect --format='{{ .Config.Hostname  }}' $CONTAINER)
+# xhost +local:$($CONTAINER_TOOL inspect --format='{{ .Config.Hostname  }}' $CONTAINER)
netbrain commented 1 year ago

Maybe create a PR that adds the Wayland/sway specific stuff to zwift.sh.?

Should be fairly easy to detect if the system runs X or Wayland yes?

On Wed, Jul 12, 2023, 17:34 quietvoid @.***> wrote:

Personally I run the script in Sway and it works perfectly fine with this diff. No issue so far.

diff --git a/zwift.sh b/zwift.sh index 12f23f0..e594b83 100755--- a/zwift.sh+++ b/zwift.sh@@ -1,5 +1,7 @@

!/bin/bash +x

+set -e+

Use podman if available

if [[ -x "$(command -v podman)" ]] then@@ -9,7 +11,7 @@ else fi

The home directory to store zwift data-ZWIFT_HOME=${ZWIFT_HOME:-$HOME/.zwift/$USER}+ZWIFT_HOME=${ZWIFT_HOME:-$HOME/.config/.zwift}

Set the container image to use

IMAGE=${IMAGE:-docker.io/netbrain/zwift}@@ -19,7 +21,7 @@ VERSION=${VERSION:-latest}

Create the zwift home directory if not already exists

mkdir -p $ZWIFT_HOME-$CONTAINER_TOOL unshare chown $UID:$UID -R $ZWIFT_HOME+# $CONTAINER_TOOL unshare chown $UID:$UID -R $ZWIFT_HOME

Check for updated container image

$CONTAINER_TOOL pull $IMAGE:$VERSION@@ -45,4 +47,4 @@ CONTAINER=$($CONTAINER_TOOL run \ $IMAGE:$VERSION)

Allow container to connect to X-xhost +local:$($CONTAINER_TOOL inspect --format='{{ .Config.Hostname }}' $CONTAINER)+# xhost +local:$($CONTAINER_TOOL inspect --format='{{ .Config.Hostname }}' $CONTAINER)

— Reply to this email directly, view it on GitHub https://github.com/netbrain/zwift/issues/14#issuecomment-1632764532, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACTNC3VJSVR7H4CTEPU573XP27X3ANCNFSM6AAAAAAUM5QZWU . You are receiving this because you authored the thread.Message ID: @.***>

netbrain commented 1 year ago

16 should have fixed the issue.

quietvoid commented 8 months ago

For info I've tried the new Wine Wayland driver, with Wine 9.3. It seems only Vulkan is supported as of today, so Zwift comes up with an OpenGL error.

There seems to be ongoing work to support OpenGL, so maybe in a couple months it'll be possible.

quietvoid commented 7 months ago

Tested working in Wine 9.4, Zwift must be configured to be full screen otherwise there are extra Wine window decorations. The image must be run with these configs:

-e XDG_RUNTIME_DIR=/tmp \
-e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
-v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY