Skip to content

Instantly share code, notes, and snippets.

@valorad
Last active November 13, 2020 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save valorad/afdc95338d133b52569409a8bc6ae1a4 to your computer and use it in GitHub Desktop.
Save valorad/afdc95338d133b52569409a8bc6ae1a4 to your computer and use it in GitHub Desktop.
Help fish user desktop find those installed flatpak/snapd apps

Help fish user desktop find those installed flatpak/snapd apps

Fish (friendly interactive shell) users find themselves losing their installed snapd/flatpak apps after restarting the desktop.

These apps can be run with respective commands. However, they are unable to be found at the desktop menu. They cannot associate default apps either.

What's happening?

If you are also a fish user, when you run flatpak update, you get this:

Note that the directories

'/var/lib/flatpak/exports/share'
'/home/[username]/.local/share/flatpak/exports/share'

are not in the search path set by the XDG_DATA_DIRS environment variable, so
applications installed by Flatpak may not appear on your desktop until the
session is restarted.

Then you try running echo $XDG_DATA_DIRS, you get an empty string.

These flatpak apps are not in the PATH env, and this is the main reason that these installed apps disappear.

Why it is not loaded? Because fish does not (and cannot) load /etc/profile. This a crucial step to add those paths to the env and let desktop know where the flatpak/snapd apps are installed.

Hot to fix this?

  • Install fisher, the plugin manager for fish.

  • Install a plugin called bass, which can be used to "source" a sh file.

fisher install edc/bass

(we need this plugin because we cannot do fish bash source xxx, because that way it will throw an error: bash: source: no such file or directory)

  • Create or edit the existing file ~/.config/fish/config.fish, add the following line and save.
bass source /etc/profile
  • Log out log in, or restart you computer. You can see those apps are back.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment