Repository navigation
fix: fallback to x11 gdk backend on error - #13
Conversation
| exec_command='exec "${HERE}"/ld-linux-x86-64.so.2 --library-path "${HERE}"/usr/lib "${HERE}"/usr/bin/ghostty "$@"' | ||
|
|
||
| # Attempt to run normally or fallback GDK_BACKEND to x11 | ||
| if ! eval "$exec_command"; then |
There was a problem hiding this comment.
The problem with this method is that the application will be relaunched for any error and not just the wayland error.
So this should only happen if we check that we are on a wayland session at least, iirc there is an env variable you can check to determine that.
There was a problem hiding this comment.
❯ echo $WAYLAND_DISPLAY
wayland-0
should this be suffice, for x11 this should return null
There was a problem hiding this comment.
I also don't think you need to use eval and just check if $? is greater than 0.
|
I would do something like this instead: |
3914f8c to
9c0ac7d
Compare
Agree with this approach, check my latest -- thought of avoiding the same command twice and reference it from an array for readability. |
| command=("${HERE}/ld-linux-x86-64.so.2" --library-path "${HERE}/usr/lib" "${HERE}/usr/bin/ghostty" "$@") | ||
|
|
||
| # Check if WAYLAND_DISPLAY is set, attempt normally or fallback GDK_BACKEND to x11 | ||
| if [ -z "$WAYLAND_DISPLAY" ]; then |
There was a problem hiding this comment.
shouldn't this be -n "$WAYLAND_DISPLAY"?
also I don't think "${command[@]}" is posix, remember we are using sh and not bash
There was a problem hiding this comment.
100% -- wasn't thinking of POSIX standards. Amended the suggestions :)
9c0ac7d to
894a650
Compare
|
Btw the original person that made the issue said this:
So none of this is ideal, because on wayland people will see the window open for 2 seconds, then close and finally open again. every time they launch the appimage we would need to create a file to indicate that wayland failed and check at runtime and all of that xd. I think it is better to just always set |
Good merge and release ? |
I don't think so. The problem with this solution is that the app doesn't crash instantly, it instead opens a window for a second and then closes. So the user that had this problem is going to see the window open for a second, close and then finally open again, instead just opening right the first time. |
|
merged with the fallback solution at the moment |
workaround, fixes #12