configuring a flatpak app (BlackBox) as the default terminal

So I recently installed the BlackBox terminal. I like it, and would like to set it as the default terminal. However, it’s installed through flatpak and when I try running
sudo update-alternatives --config x-terminal-emulator it does not appear as an option:

enter image description here

I saw that you can register new terminals with the command:

sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /path/to/emulator 1

But when I looked into what path is used to run Black Box, I found this:

/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=blackbox com.raggesilver.BlackBox

So how do I configure this as an alternative? Is it even possible?

Asked By: yuvi

||

Can my example help you? I set up BlackBox launch via standard hotkeys. I went into settings -> search -> key -> custom -> new command flatpak run com.raggesilver.BlackBox and set CtrlAltT (for Ubuntu)

Answered By: Yevgeniy Muratshayev

Got it to work with some dirty hacks, here’s how:

  1. Create a bootstrap script
    echo > /usr/local/bin/blackbox <<EOF
    #!/usr/bin/env bash
    /usr/bin/flatpak run --branch=stable --arch=x86_64 --command="blackbox" com.raggesilver.BlackBox
    EOF
    sudo chmod +x /usr/local/bin/blackbox
    
  2. Install said script as alternative
    sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/local/bin/blackbox 1
    
  3. Select it as default:
    sudo update-alternatives --config x-terminal-emulator
    
Answered By: Martynas Petuška