How to restore Ubuntu apps installed from Snap after switching to Zshell from Bash.
A Broken App Drawer After Moving to Zsh
I recently undertook a major effort to unify my shell environment across Ubuntu and macOS systems in order to make it seamless when switching from one machine to another working on cross-platform projects.
One unfortunate side-effect was that the switch from bash to z-shell in Ubuntu broke my app drawer — no apps installed via Snap showed up in the GUI at all. They totally disappeared from the app drawer, and my favorites in the menu / toolbar disappeared. Using VS Code, for example, required me to launch it from the command line, which wasn’t great.
The Fix
It looks like there are two scripts that are sourced by Bash by default that export environment variables which tell Wayland and Flatpak where to find and load the GUI applications.
Here’s how to restore them to your Zsh environment:
- sudo edit your zprofile:
sudo (vim, nano, vi) /etc/zsh/zprofile
2. Add these two lines to the end of the profile to ensure Zsh is sourcing the ENV vars that lets wayland etc. find your snap apps:
emulate sh -c ‘source /etc/profile.d/apps-bin-path.sh’
emulate sh -c ‘source /etc/profile.d/flatpak.sh’
3. save your edited zprofile
4. reboot your machine
Checking The Fix
Upon reboot, open your app drawer and see that your Snap /flatpack apps are restored. As a note: some other solutions were out there about exporting various XDG_(something) variables in ~/.zshrc — none of that worked, only this worked at the system level, which makes some sense since it is exported before the user is logged in.
Credit to this handy write-up: https://realjenius.com/2020/01/12/kde-neon-snap-apps-missing/