Home

Awesome

zsh-window-title GitHub release (latest by date)

A zsh plugin for informative terminal window titles

<!-- TOC -->

Requirements

Installation

Homebrew

brew install olets/tap/zsh-window-title

With a shell plugin manager

  1. Install zsh-window-title with a zsh plugin manager. Each has their own way of doing things. See your package manager's documentation or the zsh plugin manager plugin installation procedures gist.

    After adding the plugin to the manager, restart zsh:

    exec zsh
    

Manual

  1. Download the latest zsh-window-title binary
  2. Either
    • Put the file zsh-window-title in a directory in your PATH and add source zsh-window-title to your ~/.zshrc file
    • Add source the/path/to/zsh-window-title to your ~/.zshrc file
  3. Restart zsh:
    exec zsh
    

Usage

Once zsh-window-title is installed, your terminal window title will be

For example, after running sleep 2 in the directory ~/olets/zsh-window-title, the window title will be olets/zsh-window-title - sleep. After running sudo sleep 2, it will be olets/zsh-window-title - sudo sleep.

Note that the command is not parsed. If you run echo hello world && sleep 10, the window title will show echo for the duration, not echo for a moment and then sleep.

The number of path segments to show is configurable, and so are the prefixes. See Options.

macOS Terminal.app users

By default macOS's Terminal app will control the window title. Disable that by:

Preferences > Profiles > Window > Title --> uncheck everything.

Oh-My-Zsh users

By default OMZ will control the terminal window title. Disable that by adding

DISABLE_AUTO_TITLE=”true”

to your ~/.zshrc file.

CLI

zwt restore-defaults
    (help | --help | -h)
    (version | --version | -v)

Options

VariableTypeDefaultUse
ZSH_WINDOW_TITLE_COMMAND_PREFIXESarray( sudo )If the command starts with one of these terms, show it and the following word. (With the default, running sudo sleep 10 will add sudo sleep to the window title.)
ZSH_WINDOW_TITLE_DEBUGinteger0If non-zero, print hook debugging messages
ZSH_WINDOW_TITLE_DIRECTORY_DEPTHinteger2How many directory levels to display
ZWT_DEBUGinteger0If non-zero, print CLI debugging messages

Changelog

See the CHANGELOG file.

Roadmap

See the ROADMAP file.

Contributing

Thanks for your interest. Contributions are welcome!

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Check the Issues to see if your topic has been discussed before or if it is being worked on.

Please read CONTRIBUTING.md before opening a pull request.

License

<p xmlns:dct="http://purl.org/dc/terms/" xmlns:cc="http://creativecommons.org/ns#" class="license-text"><a rel="cc:attributionURL" property="dct:title" href="https://www.github.com/olets/zsh-window-title">zsh-window-title</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://www.github.com/olets">Henry Bley-Vroman</a> is licensed under <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0">CC BY-NC-SA 4.0</a> with a human rights condition from <a href="https://firstdonoharm.dev/version/2/1/license.html">Hippocratic License 2.1</a>. Persons interested in using or adapting this work for commercial purposes should contact the author.</p>

<img alt="Licensed under Creative Commons" title="Licensed under Creative Commons" style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1" /><img alt="Licensed with an attribution term" title="Licensed with an attribution term" style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1" /><img alt="Licensed with a non-commercial term" title="Licensed with a non-commercial term" style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/nc.svg?ref=chooser-v1" /><img alt="Licensed with a share-alike term" title="Licensed with a share-alike term" style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/sa.svg?ref=chooser-v1" />

For the full text of the license, see the LICENSE file.