Bug 407515 - Desktop files from flatpaks don't show up
Summary: Desktop files from flatpaks don't show up
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: 5.15.5
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords: wayland
: 391628 428548 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-05-14 09:19 UTC by Rohan Garg
Modified: 2022-01-09 21:55 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rohan Garg 2019-05-14 09:19:19 UTC
SUMMARY

It seems that the XDG_DATA_DIRS environment variable is not exported into the session as is done for the X11 session. 

STEPS TO REPRODUCE
1. Install a app via flatpak
2. Try to find newly installed app via krunner
3. krunner does not show any results


OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Harald Sitter 2019-05-14 09:21:47 UTC
Also applies to snaps btw.

$ grep -rl XDG_DATA /etc/profile.d
/etc/profile.d/apps-bin-path.sh
/etc/profile.d/flatpak.sh

If I were to guess it's because our session does not spin out of a shell but is purely started by c++ and thus never loads the profile scripts.
Comment 2 Rohan Garg 2019-05-14 09:25:12 UTC
I thought the session was spun out of /usr/bin/startplasmacompositor, which is a shell script.
Comment 3 Harald Sitter 2019-05-14 09:27:59 UTC
So it is, makes the bug weirder though.

$ grep Exec /usr/share/wayland-sessions/plasmawayland.desktop  
Exec=dbus-run-session /usr/bin/startplasmacompositor
TryExec=/usr/bin/startplasmacompositor
Comment 4 Rohan Garg 2019-05-14 13:46:15 UTC
Things that I tried and didn't work :

* Wayland doesn't source /etc/profile.d/flatpak.sh
* Running that script via the KDE startup mechanism
* Creating a /etc/environment.d/990-flatpak.conf

Not really sure how else to inject the flatpak path's into the Wayland session.
Comment 5 David Edmundson 2019-05-14 13:58:26 UTC
/etc/profile.d is normally sourced from SDDM via /usr/share/sddm/scripts/Xsession

The wayland version is /usr/share/sddm/scripts/wayland-session which looks to me to still include /etc/profile 


It possibly means that we're sourcing fine and kwin is destroying the env. I shall investigate.
Comment 6 Rohan Garg 2019-05-16 13:15:45 UTC
Potentially related : https://bugzilla.redhat.com/show_bug.cgi?id=92132

Though after applying the workaround checking the environment of kwin_wayland still does not have the correct XDG_DATA_DIRS.

I investigated /usr/share/sddm/scripts/wayland-session and realised that it doesn't actually source zshrc. Once I made it source zshrc, everything works properly.

I also noticed that for the XSession Neon ships a /etc/X11/Xsession.d/20flatpak which is probably what makes it work on X11.
Comment 7 Roman Gilg 2019-06-08 14:03:33 UTC
The problem is once again zsh configuration. The /etc/profile.d/ files are not sourced by default with zsh, whereas sourcing /etc/profile in bash leads to sourcing all the files in /etc/profile.d

Sourcing the files manually in $HOME/.zprofile makes it work. But this should work by default, so as a quick workaround the apps-bin-path.sh and flatpak.sh files should just be additionally sourced in the startup-script when zsh is the used shell.

It's ugly anyway. Why are the shells even involved? Setting these environment variable for our non-terminal desktop environment shouldn't be in any way related with them in the first place.
Comment 8 tguen 2021-02-19 09:49:27 UTC
I'm having this problem as well. I have my shell set to fish. Oddly enough, if I open Krunner and run `plasmashell --replace` then it works.
Comment 9 Nate Graham 2021-08-31 18:50:04 UTC
*** Bug 428548 has been marked as a duplicate of this bug. ***
Comment 10 Nate Graham 2021-08-31 18:50:08 UTC
*** Bug 391628 has been marked as a duplicate of this bug. ***
Comment 11 David Edmundson 2022-01-09 21:55:43 UTC
>I investigated /usr/share/sddm/scripts/wayland-session and realised that it doesn't actually source zshrc. Once I made it source zshrc, everything works properly.

That's upstream, it was also fixed