[Tutorial] How to replace the fedora flatpak repo with flathub

I originally posted this on reddit, but am posting here as well:

Adding flathub

Enable the flathub remote

flatpak remote-modify --no-filter --enable flathub

If it doesn’t exist, run

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Changing remotes of applications

Run this command to reinstall fedora flatpak repo applications with ones from flathub

flatpak install --reinstall flathub $(flatpak list --app-runtime=org.fedoraproject.Platform --columns=application | tail -n +1 )

Remove the fedora flatpak repo.

flatpak remote-delete fedora

Make sure that the only thing prompted for removal is the runtime, if any other application is listed, run

flatpak install --reinstall flathub name.of.application

Otherwise, just hit y