fat-tire / resolve

Container scripts to build and run DaVinci Resolve [Studio] for Linux using Docker or Podman
MIT License
192 stars 23 forks source link

resolve not launching on wayland because of missing Xauthority file #60

Closed gameflave closed 1 month ago

gameflave commented 1 month ago

I got this error when running resolve.sh

$XAUTHORITY was not set.  Defaulting to /run/user/1000/gdm/Xauthority
Error: statfs /run/user/1000/gdm/Xauthority: no such file or directory

I'm on Cachyos with hyprland. I was able to fix the problem by modifying this part in resolve.sh

# quick sanity check.
if [ -z "${XAUTHORITY}" ]; then
   if [ -f "${HOME}/.Xauthority" ]; then
      export XAUTHORITY="${HOME}/.Xauthority"

   elif [ $XDG_SESSION_TYPE = "wayland" ]; then
      export XAUTHORITY="${RESOLVE_CONFIGS}"

   else
      export XAUTHORITY="/run/user/`id -u`/gdm/Xauthority"
   fi
   echo "\$XAUTHORITY was not set.  Defaulting to ${XAUTHORITY}"
fi

Not sure if it's the best way tho fix this.

fat-tire commented 1 month ago

Hmm. I tried wayland in Ubuntu 24.04 LTS and it works alright as-is with the 560.35.03 nVideia driver without incident. CachyOS is arch-based and hyprland (which I wasn't familiar with) is a compositor for wayland instead of mutter...

It seems that your system doesn't set up a /gdm/Xauthority directory, leading to the crash. Wayland doesn't use Xauthority, so this makes sense.

Perhaps it might make more sense to check for "wayland" and then if it's running bypass the whole XAUTHORITY definition at all (or set it to /dev/null or something that doesn't matter)

[FIVE MINUTES LATER...]

I just did a test and setting it to /dev/null does seem to work, though I should note that by default there is an .mutter-Xwaylandauth value set for backwards compatibility in Ubuntu. I'm guessing this is not the case in a wayland-only system, so having a fallback makes sense.

Request: Do you want to submit a pull-request similar to your change above, but set XAUTHORITY to /dev/null instead for wayland-only distros that don't include X11 compatibility? It should probably still otherwise fall back as-is for X11-users.

Something like this:

if [ -z "${XAUTHORITY}" ]; then
   if [ -f "${HOME}/.Xauthority" ]; then
      export XAUTHORITY="${HOME}/.Xauthority"
   elif [ "$XDG_SESSION_TYPE" = "wayland" ]; then
      export XAUTHORITY="/dev/null"
   else
      export XAUTHORITY="/run/user/`id -u`/gdm/Xauthority"
   fi
   echo "\$XAUTHORITY was not set.  Defaulting to ${XAUTHORITY}"
fi

I'm also happy to do this too. Thanks!

Also, I see Resolve [19.0.3 just came out...] (https://forum.blackmagicdesign.com/viewtopic.php?f=21&t=210182&sid=22a415d1797a922298adbd9d883ce950) Exciting.

(updated with non-breaking code)

gameflave commented 1 month ago

I've made a pull request #61.

fat-tire commented 1 month ago

It looks good to me! Many thanks!