If I take a clean install of Ubuntu 17.10, install a package via snap, and change my shell to fish, after logging in again the package is missing from gnome-shell's menu and from my favorites list.
Weirdly, this also only happens when using Wayland.
What could cause this issue? I can confirm my shell works normally and the path is normal. I can also confirm these applications run fine via snap run or their command line versions, but it's as if the *.desktop files are missing.
Create ~/.config/fish/config.fish if it doesn't exist, and add the following two lines
This will put snap applications on your path and make your shortcut icons available.
The problem: The issue is linked to your login shell.
The variable
XDG_DATA_DIRS
is set when/etc/profile.d
is sourced (/etc/profile.d/apps-bin-path.sh
)But if you use fish-shell, as is your case, or zsh, you are not sourcing
/etc/profile.d/
and thereforeXDG_DATA_DIRS
is never set and the.desktop
files in/var/lib/snapd/desktop
won't be found. That's not a bug but it's due to fish not being POSIX 1003.1 compatible. That meaning that these shells doesn't understand the bash syntax.The workaround:
I can think of at least two workarounds.
The simple one is to reverse the default shell to bash with
And then add the line
At the end of the
~/.bashrc
. By doing this your login shell would be bash and your/etc/profile.d
would be sourced, but you would be using fish every time you open your terminal. And writing 'exit' on your terminal would jump back to bash.A trickiest one is to keep fish as your login shell but force the
/etc/profile.d
to be sourced. To do this you need to follow these steps:from you fish shell install fisher and bass (make Bash utilities usable in Fish shell).
edit your
~/.config/fish/config.fish
(create It if it doesn't exist) and source every file under/etc/profile.d
using bass.(In another terminal
ls
the/etc/profile.d directory
to get the list of files. Copy them)Paste the list in your nano terminal like this:
Save, close, close session or restart and 'ta-da'.
With this option you keep fish as your login shell but you have to check the
/etc/profile.d
directory every now and then to make sure there isn't a new file your not sourcing.In addition to what is suggested in Esteban Vergara's answer, I added these lines to my
~/.config/fish/config.fish
file:This will prevent the issue of having to check your
profile.d
folder regularly as he suggested, as it will recursively load all sh files in that folder on session start.