Skip to content

Instantly share code, notes, and snippets.

@james1236
Last active July 18, 2025 00:33
Show Gist options
  • Select an option

  • Save james1236/73bb8b7279dca0bc821518abada38f1e to your computer and use it in GitHub Desktop.

Select an option

Save james1236/73bb8b7279dca0bc821518abada38f1e to your computer and use it in GitHub Desktop.
Powerline10k tmux status window list

p10k tmux window list

Display your tmux window list directly in your terminal prompt, eliminating the tmux status bar.

image

Adds an additional powerline10k right prompt containing the window list from your tmux status

Note

Terminal prompts only update when you press enter, so you may see an out of date window list

Steps

Place this inside your ~/.p10k.zsh

function prompt_tmux() {
  if [ -n "$TMUX" ]; then
    local color=68
    local output="$(tmux list-windows -F ' #I #W#{window_flags} ' | tr '\n' '|' | sed 's/|$//' | sed "s/|/%F{8}|%F{$color}/g" | awk '{$1=$1};1')"
 
    local active_color=117
    output="$(echo "$output" | sed -E "s/([0-9][^0-9]*)\*/%B%F{$active_color}&%b/g")"
    
    if [[ "$output" == *"not ready"* ]]; then
      return
    fi
    
    p10k segment -f $color -t "$output"
  fi
}

And in the same file add tmux to your existing POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS similar to below

  typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
    # =========================[ Line #1 ]=========================
    status                  # exit code of the last command
    command_execution_time  # duration of the last command
    background_jobs         # presence of background jobs
    tmux                    # <- added this

Optional: Choose a different color below:

image

Optional: Place this in your ~/.tmux.conf if you'd like to hide your existing tmux status bar

set -g status off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment