Skip to content

DepoXy/sh-humble-prompt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

sh-humble-prompt

This library configures the terminal prompt (PS1 and PS2) and window title (PS4) for your shell.

It's used by Homefries: https://github.com/landonb/home-fries 🍟

Features

Prompt features:

  • Sports a different icon depending on what host you're on.

    • E.g., when logged on locally, you might see

      user@local:~ 🍄 $
      
    • Or when logged on to a remote host over SSH, you might see instead:

      user@remote:~ 💀 $
      
  • Prints the user name, hostname, and path in different colors.

  • Prints the final prompt character $ in red if the last command failed.

  • Print the final prompt character in parentheses ($) when you're in the middle of git-rebase.

Window title features:

  • As you open new terminal windows, prepends a sequential number (from 1. to 9.) to the window title.

  • Prints the leading ~/ in the window title when you're in a top-level user home directory (e.g., ~/.local).

    • Otherwise just prints the current directory name.
  • When executing a command, prints the command name in the window title.

Dependencies

For Wayland support, install window-calls GNOME Shell extension:

https://extensions.gnome.org/extension/4724/window-calls/

https://github.com/ickyicky/window-calls

  • The window-calls extension lets this project get a list of window titles, so that it can determine the next window number to use for each new terminal window (which enables the terminal window hotkeys).

  • E.g., if you want to list window titles, try:

    gdbus call --session --dest org.gnome.Shell \
      --object-path /org/gnome/Shell/Extensions/Windows \
      --method org.gnome.Shell.Extensions.Windows.List
    
  • Note that window-calls is a great replacement for X Window functionality you'd access via wmctrl or xdotool.

    • Or, if you're a macOS user, window-calls enables a lot of functionality you might instead access using Hammerspoon.

Related Projects

About

Shell prompt and terminal window title enhancements

Resources

License

Stars

Watchers

Forks

Packages

No packages published