LoginSignup
3
1

tmux の status line の色を変更

Last updated at Posted at 2023-11-27

今までtmuxの見た目は、ほぼデフォルトのままでやってきました。そろそろ 自分らしさ を出していこうと思います。

調べた内容をここにメモします。

status line

マニュアルによると

  • 画面下部にある帯
  • 現在のセッションに関する情報が表示される
  • 対話型コマンドの入力に使用される

A status line at the bottom of the screen shows information on the current session and is used to enter interactive commands.

tmux-status-line-default.png

設定方法

status line の設定方法はこの記事に完結にまとめられていました。

set-optionコマンドにはsetという偽名が定義されているので、短くsetと記述できます。
set-window-optionコマンドも、短くsetとして問題ないようです。setコマンド一つでいけます。

永続化させたい設定は設定ファイル($HOME/.tmux.conf)にset -g ...と書きます。
一時的に試したい場合は、tmuxコマンドとsetコマンドを組み合わせて、ターミナルでtmux set -g ...と打つことも可能です。
-gは「グローバルオプションとして設定」という意味ですが、深く考えずset -g ...でいいと思います。

status-styleコマンドを用いて status line のfg(foreground colour)とbg(background colour)を変更できます。
fgは文字の色、bgは背景の色です。 両方またはどちらか一方を調整することにより、お好みの色の組み合わせにします。

$HOME/.tmux.conf
set -g status-style 'bg=black,fg=white'

現在アクティブなウインドウ名の見た目だけ変更したい場合は、window-status-current-formatwindow-status-current-styleが便利です。

$HOME/.tmux.conf
# 現在アクティブなウインドウ名の文字の色を背景の色を入替
set -g window-status-current-format "#[reverse] #I:#W"

# 現在アクティブなウインドウ名の文字の色を背景の色を指定
set -g window-status-current-style 'bg=colour002,fg=black'

自分らしさ

  • シンプルな見た目が好み
  • tmuxを使っていることを意識できるよう(白黒ではなく)色は残す
  • どのウインドウがアクティブなのか一目でわかるようにしたい

これに決定!

$HOME/.tmux.conf
set -g status-right ''
set -g status-style 'bg=colour022,fg=colour064'
set -g window-status-current-style 'bg=colour022,fg=colour010'

tmux-status-line-custom.png

:tada::tada::tada:

使える色

  • black, red, green, yellow, blue, magenta, cyan, white
  • (明るい色がサポートされている場合) brightred, brightgreen, brightyellow
  • 8ビットカラーの256色(colour0colour255
  • defaulttmuxのデフォルト)
  • terminal(ターミナルのデフォルト)
  • RGB#000000#ffffff

色の見本はWikipediaにいいのがありました。

さいごに

非アクティブのウインドウペイン(窓ガラス)の背景色の変更にも取り組みました。もしよかったらご覧ください。

本記事は autoracex #259 の成果です。ありがとうございます。

toukon-qiita-macbook_20230912_091808.jpg

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1