Pulse – A fast, configurable Rust PS1 prompt engine for modern shells.
- Rust (latest stable version recommended)
git clone https://github.com/juliankahlert/pulse.git
cd pulse
cargo build --releaseThe binary will be available at target/release/pulse.
To use Pulse as your shell prompt, set the PS1 environment variable in your shell configuration (e.g., ~/.bashrc, ~/.zshrc):
export PS1="\$(pulse)"To display the exit code of the last command in the prompt, also add the following to your shell configuration:
export PROMPT_COMMAND='export LAST_EXIT_CODE=$?'This will execute pulse every time the prompt is displayed, generating the customized prompt with the correct exit code.
Configure the prompt via /etc/pulse/config.yaml (global) and ~/.config/pulse/config.yaml (user-specific).
Pulse supports coloring different segments of the prompt using a predefined color palette inspired by clrs.cc. You can specify colors for various prompt segments in your configuration file.
Default is coloring for dark background.
The following colors are available for use in segment coloring:
- Navy
- Blue
- Aqua
- Teal
- Olive
- Green
- Lime
- Yellow
- Orange
- Red
- Maroon
- Fuchsia
- Purple
- Black
- Gray
- Silver
- White
- Magenta
segments:
- name: username
color: Blue
- name: hostname
color: Green
- name: current_directory
color: NavyDefault is dialline with git
A compact single-line prompt:
user@host:~ pulse $
Description: The prompt consists of segments: username (user), separator (@), hostname (host), separator (:), current directory (~), space, prompt name (pulse), space, and shell prompt ($). No UTF-8 special characters are used.
A multi-line prompt with path navigation:
user@host:~ pulse › src › main
└─ 0 $
Description: Multi-line prompt with first line showing: username@user@host:~ pulse › src › main (segments: username, @, hostname, :, current dir ~, space, pulse, space, › (U+203A) separator, directory segments src › main). Second line: └─ (U+2514 U+2500) separator, exit code of the last command (0), space, $.
A multi-line prompt with deep path navigation and root starting in home dir:
user@host:~ … pulse › src › main
└─ 0 $
Description: Similar to above, but with ellipsis (…) (U+2026) indicating truncated path (path segments are truncated if there are more than 3) starting from home (). First line: user@host: … pulse › src › main. Second line: └─ (U+2514 U+2500) separator, exit code of the last command (0), space, $.
A multi-line prompt with deep path navigation and root NOT starting in home dir:
user@host:/ … hwmon › hwmon2 › power
└─ 0 $
Description: Path starts from root (/), with ellipsis (…) (U+2026) for truncation (path segments are truncated if there are more than 3). First line: user@host:/ … hwmon › hwmon2 › power. Second line: └─ (U+2514 U+2500) separator, exit code of the last command (0), space, $.
A multi-line prompt with path navigation with a subpath of a git repository:
user@host: [repository-name] src › main
└─ 0 $
Description: Includes git repository name in brackets. First line: user@host: [repository-name : branch] src › main. Segments: username, @, hostname, :, space, [repository : branch], space, directory segments. Second line: └─ (U+2514 U+2500) separator, exit code of the last command (0), space, $.