Skip to content
This repository has been archived by the owner on Jun 12, 2021. It is now read-only.
/ bronze Public archive

A cross-shell customizable powerline-like prompt with icons

License

Notifications You must be signed in to change notification settings

reujab/bronze

Repository files navigation

bronze

A cross-shell customizable powerline-like prompt heavily inspired by Agnoster.

Rust port

There is a new, compatible, 50% faster port of this called silver written in Rust. Silver is compatible with the same configuration as bronze once you rename variables from BRONZE to SILVER ($BRONZE -> $SILVER, $BRONZE_SHELL -> $SILVER_SHELL, ...). The only main difference is that silver does not support the packages or plugin modules.

How does it work?

Unlike pretty much every other shell prompt, bronze is not written in shell script, but entirely in Go, so all prompt segments are loaded asynchronously for a speed boost.

When bronze init is run, it outputs shell code that sets your prompt to run bronze prompt, which outputs the actual prompt. The bronze prompt command relies on environment variables for configuration.

Getting started

Since bronze is not written in shell script, it should theoretically be compatible with any shell, but the three supported shells are Bash, Zsh, and fish.

Icons

To be able to use the custom icons (which are enabled by default), you must patch your font or install a pre-patched font from Nerd Fonts.

Installation

From source

  • install and setup Go
  • install libgit2 development packages
  • run go get github.com/reujab/bronze

From pre-compiled binary

  • download a binary on the releases page
  • add binary to PATH environment variable

macOS

On macOS, you will have to do a bit more:

  • install Homebrew
  • run brew install coreutils
  • add alias date="gdate" to your shell rc

Configuration

Now that you have bronze installed, you need to configure it. To have your prompt look like the one in the screenshot above, add this to your ~/.bashrc/~/.zshrc:

BRONZE=(status:black:white dir:blue:black git:green:black cmdtime:magenta:black)
export BRONZE_SHELL=$SHELL # bash, zsh, or fish

Or add the following to your ~/.config/fish/config.fish:

set BRONZE status:black:white dir:blue:black git:green:black cmdtime:magenta:black
set -x BRONZE_SHELL fish

Now that bronze is configured, you need to evaluate its bootstrap code.

~/.bashrc/~/.zshrc:

eval "$(bronze init)"

~/.config/fish/config.fish:

eval (bronze init)

Documentation

Documentation is available on the wiki.

Project structure

  • packagesd/
    • main.go
      • source code for the packages module daemon
    • packagesd.service
      • a systemd service file
      • can be placed in /usr/lib/systemd/system/
      • can be enabled with systemctl enable packagesd
      • can be started with systemctl start packagesd
  • static/
    • ab0x.go
      • a file automatically generated with go generate
      • contains the shell script files that are printed when running bronze init
  • types/
  • cmdtime.go
    • source code for the cmdtime module
  • dir.go
    • source code for the dir module
  • env.go
    • source code for the env module
  • git.go
    • source code for the git module
  • icons.go
    • initializes every icon based on BRONZE_ICONS and other environment variables
  • init.bash
    • bootstraps prompt for Bash
  • init.fish
    • bootstraps prompt for fish
  • init.go
    • source code for the init subcommand
  • init.zsh
    • bootstraps prompt for Zsh
  • main.go
    • parses command line arguments
  • modules.go
    • contains logic that determines which module function to call
  • os.go
    • source code for the os module
  • packages.go
  • plugin.go
    • source code for the plugin module
    • invokes code from dynamic libraries (.so files)
  • print.go
    • source code for the print subcommand
  • sh.go
    • contains shell-specific code
  • status.go
    • source code for the status module
  • time.go
    • source code for the time module
  • user.go
    • source code for the user module

Similar projects

powerline-go