1
4
Fork
You've already forked statusline
1
Beautiful and fast bash PS1
  • Rust 97.1%
  • Shell 2.6%
  • Nix 0.3%
2026年07月05日 19:36:54 +00:00
src natural order of doc-comments and attribute macros for argh 2026年07月05日 19:36:54 +00:00
.envrc use direnv 2026年07月02日 19:43:06 +00:00
.gitignore use direnv 2026年07月02日 19:43:06 +00:00
.mailmap fix mailmap 2026年04月23日 21:49:53 +03:00
Cargo.lock use shell_quote instead of Not Escaping At All 2026年07月05日 03:36:14 +00:00
Cargo.toml use shell_quote instead of Not Escaping At All 2026年07月05日 03:36:14 +00:00
COPYING.Apache-2.0 Use more free license 2024年09月10日 10:01:44 +03:00
COPYING.MIT Use more free license 2024年09月10日 10:01:44 +03:00
default.nix Use rust from nixpkgs (unstable); disable nightly 2025年09月10日 18:30:02 +03:00
README.md readme: clarify dynamic blocks 2026年07月05日 05:28:27 +00:00

statusline

A blazingly-fast1 successor to purplesyringa's shell, rewritten in Rust.

TODO: maybe some screenshots to show what it's like?

Requirements

  • a decently modern linux kernel
  • bash, obviously
  • git binary (optional, recommended)
  • cargo or nix
  • a little bit of time and patience

Installation

  1. Install rustup and stable rust.

    pacman -S rustup
    rustup toolchain add stable
    

    Visit rustup.rs if not on Arch-based distro to see how to install on other distros. You may need to run rustup installation with superuser rights

  2. Install statusline from cargo

    cargo install statusline
    
  3. Check if statusline is in path.

    statusline
    

    If "bash: statusline: command not found" is shown, check your $PATH and ~/.bashrc, a folder where cargo install placed statusline binary should be there.

    If you wish to not add the directory to $PATH, you can just use full path instead of short one in statusline env below

  4. Install the statusline to shell

    echo 'source <(statusline env)' >> ~/.bashrc
    
  5. Apply changes immediately

    PS1_MODE=minimal source <(statusline env)
    

Don't forget to check $PATH and update from time to time.

Nix way

Build and apply immediately:

nix-build --log-format multiline-with-logs && source <(result/bin/statusline env)

NixOS usage example can be found in my configuration.

Features

Like any fancy PS1, this one supports color. It detects tmux and tty and resets itself to text-friendly mode, and also detects terminals that call themselves dumb and doesn't modify PS1 in that case at all.

statusline simplifies displayed paths. /home/<yourusername> becomes ~, and /home/<another> becomes ~another, like bash tilde expansion, but in reverse.

statusline integrates with Git and is able to show basic information about repositories it encounters even without git binary present.

One notable feature, though, is colorized hostnames, usernames and git branches. They get assigned a random color and it helps differentiate between hosts, users and branches. The color red is reserved for root. The colors displayed are "true" (24-bit), meaning that tty or other lesser-color terminals may collide some colors and revert the disambiguation.

Customization

statusline has limited customization options. All customization options are set with PS1_... environment variables.

PS1_MODE: Icon set

  • unset: use default nerd font icon set
  • minimal: use alternative nerd font icon set which is somewhat simpler but may be perplexing
  • text: always use ASCII text

statusline automatically detects dumb terminals and does nothing, and it also detects tty/tmux/screen and falls back to text mode on these as these might not support nerd fonts.

Block order

statusline has four groups of blocks: left, middle, right, and bottom, which are arranged in two or three lines depending on the width:

  • two-line: left middle _ right / bottom
  • three-line: left _ right / middle / bottom

Only left blocks support dynamic updates.

Supported blocks and their default placement are listed below.

  • Lhost_user: hostname, username, chassis
  • Lssh: ssh sesion, workgroup ssh chain
  • Lgit_repo: git branch, git state, stash count; dynamic: ahead-behind
  • Lgit_tree: dynamic: number of staged, modified, untracked, or unmerged files
  • Lbuild_info: detected magic files such as Cargo.toml or default.nix
  • Lnix_shell: nix-shell, nix3 shells, direnv environments
  • Lvenv: python venv
  • Mworkdir: working directory with homes folded and most nested git repo highlighted
  • Relapsed: previous command elapsed time
  • Rreturn_code: previous command return code, $?
  • Runseen_mail: like $MAILCHECK in bash
  • Rjobs: background jobs count
  • Rtime: current date and time
  • Broot_shell: is current user root, $SHLVL

PS1_LEFT, PS1_MIDDLE, PS1_RIGHT, PS1_BOTTOM variables accept comma-separated list of block names.

How is this different from purplesyringa's shell?

There once was a bashful list of why one should use this version over the bash one, but the gist of it is that the bash version was slow, unmaintained, buggy, and a maintenance burden.

Command line options

statusline (without args)

Shows the version, link to the repo, and a simple how-to-use message.

statusline [command] --help or statusline help [command]

Shows help messages.

statusline env

Prints contents of what's executed by recommended bashrc snippet. Do not source the snippet directly, as its contents will change without notice.

statusline run [...options]

This command is run by bash at every PS1 instantiation. One can run it without bash to profile the prompt, or to see how the PS1 would look without installing PS1 into the shell. Some arguments have defaults that are only set from within "env" script.

statusline create, statusline chain and ssh alias

Undocumented ssh workgroup feature. Never got to documenting it, basically.


  1. compared to shell, but this claim was made off general vibes and might have been wrong. It is probably faster, though not by that much. ↩︎