Setting Gnome terminal to Flatpak app

When setting up a new linux machine, I found myself needing to set the gnome terminal to a terminal emulator I'd installed via Flatpak.

Since the Flatpak install is local to my user, it does not make sense to use the update-alternatives command, which is global.

Instead, gsettings can be used to set a default Gnome application for the user.

However, Flatpak apps don't appear to be avaiable in the user's PATH, which is confusing.

Recent Flatpak versions will however put a smylink to the executable in ~/.local/share/flatpak/exports/bin/. Here the applications installed by the user will be listed.

In my case, the following command solved the issue:

gsettings set org.gnome.desktop.default-applications.terminal exec /home/cash/.local/share/flatpak/exports/bin/org.wezfurlong.wezterm