mate-desktop / mate-panel

MATE panel
https://mate-desktop.org
GNU General Public License v2.0
184 stars 118 forks source link

wayland: panel run dialog cannot start xwayland apps #1387

Closed lukefromdc closed 9 months ago

lukefromdc commented 1 year ago

Expected behaviour

when running on wayland, starting an app such as GIMP (still on GTK 2) should bring it up in xwayland

Actual behaviour

non-wayland supporting apps won't open from the panel run dialog, if the panel is run from a terminal we get the same "cannot open display" messages we had in terminal until https://github.com/mate-desktop/mate-terminal/commit/79c6912d76612479a90f754983c00d3724722e28

Steps to reproduce the behaviour

Start a wlroots-supporting wayland session such as wayfire start mate-panel within that session or set up the session to autostart mate-panel (same results) add the run dialog applet to the panel click on the run dialog applet enter the name of any gtk2 or other non-wayland supporting app, it does not open and if the panel is running from a terminal look for the "cannot open display" message

MATE general version

1.27

Package version

mate-panel from git master as of 7-19-2023

Linux Distribution

Debian Unstable with locally compiled gtk 3.24.24 and wayfire 0.8 from git master

Link to bugreport of your Distribution (requirement)

None as this is a local build

DMJC commented 9 months ago

Can confirm this is happening on Debian Trixie 13 with MATE/MATE-Panel provided by the distro.

lukefromdc commented 9 months ago

We are setting not inheriting the environment both on the panel run dialog and caja open in terminal extension, disabling xwayland from both of them.

At first mate-terminal also had this problem, fixed by this commit: https://github.com/mate-desktop/mate-terminal/pull/437 Do not set DISPLAY, inherit it instead but looking at the code I am not seeing where it is being set. Note that panel launchers work fine for xwayland, its just the panel run dialog

We need to do the same for the run dialog and for the caja open in terminal extension, proof is these two terminals started different ways. Terminal on the left opened from caja desktop, can run kdenlive (in xwayland), terminal on the right opened from panel run dialog, cannot run kdenlive in xwayland:

two_terminals

lukefromdc commented 9 months ago

An equivalent change to in panel-run-dialog.c (remove line 453 display_name = g_strdup (gdk_display_get_name (display)); ) did not work, instead of inheriting the display name it got set to random gibberish

cwendling commented 9 months ago

@lukefromdc Try commenting out line 416 (g_setenv ("DISPLAY", display, TRUE);), just not setting display_name is gonna use an uninitialized variable which isn't gonna do much good :)

cwendling commented 9 months ago

BTW the code setting DISPLAY seems wrong to me. It got introduced with 3c21f66bf30810fcb25dfe8c3c0960df270dc416 trying to mimic gdk_spawn_on_screen(), but does not: what gdk_spawn_on_screen() did (on X11) was to append the screen number to the display, so that it worked on a multi-screen setup where the app is not on the default X screen. However, the code that got introduced just sets the display, which is gonna be already there anyway (yet possibly loosing the default screen in the process?), and AFAIK GDK dropped support for multi-screen setups anyway (not to be confused with multi-monitor with e.g. Xinerama).

IMO this logic should just be dropped altogether, unless somebody actually has a use for it -- yet again, I don't think the code does what it is intended to do.