Polybar
polybar はステータスバーを簡単に素早く作れるツールです。多数のモジュールを利用して、ワークスペース・日付・システムボリュームの表示など様々な機能を簡単にカスタマイズできるようになっています。Polybar は awesome や i3 などステータスバーが付属していないウィンドウマネージャで特に有用です。また、Polybar は Plasma などのデスクトップ環境でも使用できます。
インストール
polybar パッケージをインストールしてください。開発版は polybar-gitAUR です。
設定
デフォルトの設定例は/etc/polybar/config.iniです。Polybarは、~/.config/polybar/config.iniまたは/etc/xdg/polybar/config.ini、/etc/polybar/config.iniから最初に見つかったものに応じて設定ファイルをロードします。設定を編集したければ、/etc/polybar/config.iniから~/.config/polybar/config.iniにコピーして編集してください。
Polybarの実行
Polybarは以下のように起動できます:
Usage: polybar [OPTION]... BAR
-h, --help Display this help and exit
-v, --version Display build details and exit
-l, --log=LEVEL Set the logging verbosity (default: WARNING)
LEVEL is one of: error, warning, info, trace
-q, --quiet Be quiet (will override -l)
-c, --config=FILE Path to the configuration file
-r, --reload Reload when the configuration has been modified
-d, --dump=PARAM Print value of PARAM in bar section and exit
-m, --list-monitors Print list of available monitors and exit
-w, --print-wmname Print the generated WM_NAME and exit
-s, --stdout Output data to stdout instead of drawing it to the X window
-p, --png=FILE Save png snapshot to FILE after running for 3 seconds
ウィンドウマネージャの起動時にPolybarを実行したい場合は#ウィンドウマネージャで実行を見てください。
設定例
基本的なPolybarの設定は以下のようになります。
[bar/mybar] modules-right = date [module/date] type = internal/date date = %Y-%m-%d%
mybarという名前のバーと、dateというモジュールを定義しています。
デフォルトでは、Polybarは/etc/polybar/config.iniに多数の構成済みモジュールを含むサンプル構成もインストールします。
ウィンドウマネージャで実行
起動ロジックを含む 実行可能ファイル を作成します (例:$HOME/.config/polybar/launch.sh)
#!/bin/bash # Terminate already running bar instances killall -q polybar # If all your bars have ipc enabled, you can also use # polybar-msg cmd quit # Launch Polybar, using default config location ~/.config/polybar/config.ini polybar mybar 2>&1 | tee -a /tmp/polybar.log & disown echo "Polybar launched..."
このスクリプトは、ウィンドウマネージャーを再起動すると Polybar も再起動されることを意味します。
起動時にウィンドウマネージャーによってこのスクリプトを実行するには、自動起動# ウィンドウマネージャのスタートアップ時 を参照してください。
マルチモニター
複数のモニターにバーを複製したい場合は、複数のバーを起動する必要があります。
起動スクリプトに次のような内容を追加します:
if type "xrandr"; then
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
MONITOR=$m polybar --reload example &
done
else
polybar --reload example &
fi
次に、環境からモニターを読み取るように Polybar を設定します:
config.ini
[bar/example]
monitor = ${env:MONITOR:}
[..]