5

I use latest KDE neon, but I believe the problem regards not exactly KDE but Ubuntu.

When I install flatpak or snap applications KDE doesn't see them - I mean I can't find them in list of applications in the application launcher.

I made some research and I found out that both snaps and flatpak have the following dirs where they keep launchers:

for flatpak its: /var/lib/flatpak/exports/share

for snaps its: /var/lib/snapd/desktop

And I figured out that the system searches for applications in dirs defined in the variable: XDG_DATA_DIRS

So when I execute echo $XDG_DATA_DIRS I get: /usr/share//usr/share/xsessions/plasma:/usr/local/share/:/usr/share/ So it doesn't contain folders with launchers of snaps and flatpak.

What's more, I can see there are suitable scripts in the /etc/profile.d/ that should update this variable, for instance: /etc/profile.d/flatpak.sh has the following content:

# /etc/profile.d/flatpak.sh - set XDG_DATA_DIRS

if [ "${XDG_DATA_DIRS#*flatpak}" = "${XDG_DATA_DIRS}" ]; then
    XDG_DATA_DIRS="${XDG_DATA_HOME:-"$HOME/.local/share"}/flatpak/exports/share:/var/lib/flatpak/exports/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
fi

export XDG_DATA_DIRS

So I guess maybe these scripts for some reason are not executed or they are wrong? Can you guys tell me what is wrong?

  • I think I may have the same problem, or at least a similar one. For me `echo $XDG_DATA_DIRS` gives `/usr/share//usr/share/xsessions/plasma:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop`. So, same mangled "/usr/share//usr/share/xsessions/plasma" at the front, but "/var/lib/snapd/desktop" made it in too. – Kenneth Hanson Mar 23 '18 at 13:46
  • In my case, I first noticed the problem when trying to manually append the flatpak paths on login, but the additions instead ended up in the middle, and the result was so broken that Plasma failed to start. I also can't identify where the "/usr/share/xsessions/plasma" part is coming from, which makes me think that Plasma is doing something weird which is causing these problems. – Kenneth Hanson Mar 23 '18 at 13:50

3 Answers3

4

Regarding the snap issue, if you're using zsh you might be hitting this snap bug.

A workaround is to explicitly source /etc/profile.d/apps-bin-path.sh in your .zshrc or .zshenv.

Kevin Bowen
  • 19,395
  • 55
  • 76
  • 81
1

A workaround is to manually make a starter that runs /snap/bin/[your_app_name]

See Add a menu item to KDE Launcher how to do that.

Sandro L
  • 131
  • 5
  • I recommend to edit this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.) – abu_bua Oct 22 '18 at 09:58
  • Thanks @abu_bua for the suggestion. I added a link that explains this to avoid duplication. – Sandro L Oct 22 '18 at 12:32
0

Did you reboot? Or you can just log out and log in.

I've just installed flatpak and found myself in the same situation: /etc/profile.d/flatpak.sh is there but it didn't have a chance to run since it wasn't there during the startup. And the script needs to be run at startup since "the path needs to be added to this variable before your desktop manager is started".

user
  • 433
  • 4
  • 6