Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/4572.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Force Wayland on WSL2 if the WSL2 GUI apps feature is enabled
7 changes: 6 additions & 1 deletion gtk/src/toga_gtk/libs/gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@
"environment variable set correctly?"
)

IS_WAYLAND = not isinstance(Gdk.Display.get_default(), GdkX11.X11Display)
IS_WSL2_GUI_ENABLED = os.getenv("WSL2_GUI_APPS_ENABLED", "0") == "1"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we wouldn't be able to run at all if GUI apps were disabled, can we rename this to IS_WSL2?


# Force Wayland on WSL2 if the WSL2 GUI apps feature is enabled

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment should also explain why this is necessary, i.e. what is the problem with X11.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a semi related note… noting that IS_WAYLAND is only used on Toga’s side and is not passed to GTK to enable/disable Wayland support. This means that if things do not work without IS_WAYLAND special casing, then we should work out why the usual method we use to detect Wayland does not work…

IS_WAYLAND = (
not isinstance(Gdk.Display.get_default(), GdkX11.X11Display) or IS_WSL2_GUI_ENABLED
)

# The following imports will fail if the underlying libraries or their API wrappers
# aren't installed; handle failure gracefully (see
Expand Down
Loading