https://github.com/itsjfx/zsh-tmux-smart-status-bar
light, powerful, and smart tmux status bar for zsh
https://github.com/itsjfx/zsh-tmux-smart-status-bar
Last synced: 2 months ago
JSON representation
light, powerful, and smart tmux status bar for zsh
- Host: GitHub
- URL: https://github.com/itsjfx/zsh-tmux-smart-status-bar
- Owner: itsjfx
- License: gpl-3.0
- Created: 2023-01-10T11:54:56.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-02-22T12:04:03.000Z (3 months ago)
- Last Synced: 2025-03-24T11:02:29.462Z (2 months ago)
- Language: Shell
- Size: 55.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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 featuresThis script uses [terminal escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code) to update the status bar and window name efficiently using [zsh hooks](https://zsh.sourceforge.io/Doc/Release/Functions.html).
Updates are made when the shell prompt is rendered or when a command is executed.
## Features
* Lightweight and quick update mechanism with [zsh hooks](https://zsh.sourceforge.io/Doc/Release/Functions.html)
* 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`).

## Installation
Add to your `.zshrc`
```bash
source /path/to/zsh-tmux-smart-status-bar/zsh-tmux-smart-status-bar.sh
```You must have `TERM` set to a `tmux-` term, e.g. `tmux-256color`
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 onset-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](https://github.com/ofirgall/tmux-window-name)
## See also
*
*
*
*
*
* also uses terminal escape sequences as the update mechanism
*