-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only set GDK_BACKEND to "x11" if GDK_BACKEND is unset and XDG_SESSION_TYPE is not "wayland" #1811
Only set GDK_BACKEND to "x11" if GDK_BACKEND is unset and XDG_SESSION_TYPE is not "wayland" #1811
Conversation
…_TYPE is not "wayland"
I just pushed a second commit to this PR after deciding that I also ran another set of tests to make sure everything is still working as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for this! I think this is a more than acceptable way of dealing with the different backends 👍
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
Incorporated from this v2 change: wailsapp#1811
fix: enable to run natively in wayland Incorporated from this v2 change: #1811
The existing logic always sets the
GDK_BACKEND
variable tox11
, which prevents the application from using the wayland backend (or running at all in a wayland compositor if xwayland is unavailable). The reason this logic is present is because windows would fail to centre without it, so we need to keep the behaviour in x11 sessions.The
GDK_BACKEND
variable can and typically should remain unset in a wayland session, and theXDG_SESSION_TYPE
variable is usually set and can have a value ofunspecified
,tty
,x11
,wayland
ormir
.The logic in the patch is as follows; if the system has already set the
GDK_BACKEND
variable, we should assume that it knows what it's doing and keep the existing value. If theGDK_BACKEND
variable is empty however, we check to see if theXDG_SESSION_TYPE
variable is set towayland
, and if it is we shouldn't touch theGDK_BACKEND
variable. If theXDG_SESSION_TYPE
variable is not set towayland
though, we can assume we're most likely in an x11 environment in those cases. If we're in an x11 environment, we setGDK_BACKEND
tox11
and windows can be centred :)I tested this in x11 and wayland with xwayland disabled using all combinations of
XDG_SESSION_TYPE
andGDK_BACKEND
being set appropriately, inappropriately and being unset, and got the expected behaviour in all cases.This resolves #1420