Skip to content

itsjfx/zsh-tmux-smart-status-bar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 

Repository files navigation

zsh-tmux-smart-status-bar

Overview

I installed tmux to have a clean prompt by displaying information on a status bar. I wanted information on the current branch, AWS environment variables, and meaningful window/tab names based on the currently executed command or current directory.

Existing scripts didn't meet my requirements:

  • some had not great update mechanisms. they relied on polling, or on window switching
  • some were overly heavy and added unnecessary and painful delay to my shell
  • some were overly complicated for a simple task of populating a status bar
  • were missing desired features

This script uses terminal escape sequences to update the status bar and window name efficiently using zsh hooks.

Updates are made when the shell prompt is rendered or when a command is executed.

Features

  • Lightweight and quick update mechanism with zsh hooks
  • Status bar updates even if SSH'd to a machine using the plugin but not running tmux
  • Window names named after current working directory or current running process
  • The following items displayed:
    • current working directory. git repository path hightlighted if within a repo
    • current username@hostname, if ssh'd to host also using the plugin and not running tmux within ssh
    • current AWS profile, with region displayed if set to a non-default region
    • current git tag/branch
    • proxychains status (e.g if running proxychains -q zsh)

Screenshots

Status bar while SSH'd to my home machine which runs the plugin. In a git repo, with an AWS profile set.

The other tabs in my terminal are: open to /tmp, running a git command, and running vim (aliased to v).

status-bar

Installation

Add to your .zshrc

source /path/to/zsh-tmux-smart-status-bar/zsh-tmux-smart-status-bar.sh

To have a similar status bar in tmux to the screenshots, set:

# https://that.guru/blog/automatically-set-tmux-window-name
set -g allow-rename on

set-option -g status 2
set -g status-right ''
set -g status-format[1] ''
set -g status-format[1] '#[align=centre]#{pane_title}'

where #{pane_title} will have the status bar contents

You can customise the style of your tmux status bar however you like.

My full config (including options and styling) is available here:

Some helpful resources for learning how to style your bar:

TODO

  • make the window names shorter/more selective around what args are listed, like tmux-window-name

See also

About

light, powerful, and smart tmux status bar for zsh

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages