Open Source: Launch Flatpak Apps Faster with This One-Liner

I’m using sway on arch (btw) and naturally I need a terminal GUI app launcher. I was quite surprised how well it works, prerequirements are fzf and flatpak:

flatpak run (flatpak list --app --columns=application | fzf) > /dev/null 2>&1 &

How It Works

  • flatpak list --app --columns=application
    Lists all installed Flatpak applications, showing only their application IDs.
  • fzf
    Lets you interactively search and select an app from the list.
  • flatpak run (...)
    Runs the selected app.
  • > /dev/null 2>&1 &
    Hides any output and runs the app in the background.

Flatpak CLI Details

  • --app
    Filters the list to only show applications (not runtimes or extensions).
  • --columns=application
    Shows only the application ID, making the output clean and easy to use with scripts.

Bash Function for Easy Use

Add this to your ~/.bashrc or ~/.bash_profile to use it as runfp:

runfp() {
  flatpak run $(flatpak list --app --columns=application | fzf) > /dev/null 2>&1 &
}

Lately I started using fish-shell, so my function looks like this:

function runfp
  flatpak run (flatpak list --app --columns=application | fzf) > /dev/null 2>&1 &
end

I love the way fish-shell has a default workflow for creating functions, it’s so easy to use and maintain.

function # hit enter
    #write your function
end

funcsave function-name

# git commit and push to github

Version Control Your Shell Configurations

As mentioned, I version control my custom shell functions.

You can version control your ~/.config/fish/functions folder (for fish) or your ~/.bashrc (for bash) using Git and GitHub, it’s possible with bash and zsh too, but you have to set it up yourself if you want the same workflow that is.

When I use bash I usually version control my ~/.bashrc as a github gist, but I’m not a fan of it, because it’s not as modular as self-contained functions in a repo.

That said, a gist is great because you can use the github CLI to edit or create a gist from the terminal!

# create a gist
gh gist create --source=. --remote=origin --push

# list gists
gh gist list

# edit a gist
gh gist edit <gist-id> --add ~/.config/fish/functions/mycoolfunc.fish

Too easy!

How to do it with GitHub CLI:

  • Initialize a repo and push to GitHub:
    cd ~/.config/fish
    git init
    git add functions/
    git commit -m "Track my fish functions"
    gh repo create --public --source=. --remote=origin --push
    # Or for bash:
    cd ~
    git init
    git add .bashrc
    git commit -m "Track my bashrc"
    gh repo create --public --source=. --remote=origin --push

Benefits:

  • Never lose your dear functions!
  • Sync your shell setup across multiple machines
  • Share your functions with others
  • Fun!

Happy function-writing!