Dolphin not launching "open with" applications with proper environment variables when StartupNotify is false

Running dolphin 24.05.1 with KIO 6.3.0 on Hyprland + Arch Linux.

Background

After a recent update, the “open with” menus broke on dolphin. I’m currently using the workaround involving archlinux-xdg-menu (I can’t post links :confused:).
However afterwards, VSCode just refuses to launch with wayland (rather than XWayland) with using “open with” in dolphin, despite me having set ELECTRON_OZONE_PLATFORM_HINT=wayland.
I also tried changing the exec field in the desktop file to include --ozone-platform-hint=wayland.
After some digging, I believe I’ve found the cause.

The Bug (I think)

Basically, if the application you’re launching with “open with” has StartupNotify=false, then not all the environment variables get passed.

To reproduce:
Put the following contents into ~/.local/share/applications/exportenv.desktop:

[Desktop Entry]
Name=Export Environment
Exec=sh -c "env > ~/env"
Type=Application
Categories=Development

When run, this will put an env file in your home folder which contains the environment with which the .desktop file was launched.

Now, run kbuildsycoca6 --noincremental in the terminal (to rebuild some cache).
In dolphin, right click a file → open with → other application → export environment.
Now in ~/env you should see a “correct” environment.

Put StartupNotify=false on a new line at the end of exportenv.desktop,
and repeat the last paragraph (including the cache rebuilding!).
Now in ~/env you should see a (comparatively) barebones environment without all the variables which should be passed.

Can someone please check that this is a real bug and it’s incorrect behavior and not just on my machine?

1 Like