Skip to content

Instantly share code, notes, and snippets.

@runlevel5
Last active September 17, 2025 13:21
Show Gist options
  • Save runlevel5/8fe3431663c38a0aaffef126dda2780f to your computer and use it in GitHub Desktop.
Save runlevel5/8fe3431663c38a0aaffef126dda2780f to your computer and use it in GitHub Desktop.
How to have the special toolbox prompt for fish shell?

So if you happen to use fish shell for your toolbox container environment, you should set the fish_prompt by modify ~/.config/fish/config.fish:

if status is-interactive
  # Commands to run in interactive sessions can go here
  function is_toolbox
    if test -f /run/.toolboxenv
      set toolbox_name (grep -E '^name="' /run/.containerenv | cut -d \" -f 2)
      echo " ❱ $toolbox_name"
    end
  end

  set TOOLBOX_NAME (is_toolbox)
  function fish_prompt
    if test -n "$TOOLBOX_NAME"
      set_color magenta
      echo -n -e "\n⬢ "
      set_color normal
      echo -n "["(whoami)"@"(hostname)"$TOOLBOX_NAME "(prompt_pwd)"]\$ "
    else
      set_color normal
      echo -n "["(whoami)"@"(hostname)" "(prompt_pwd)"]\$ "
    end
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment