「Polybar」の版間の差分
(→設定: 情報を翻訳して更新) |
(マルチモニターを翻訳して追加) |
||
| 93行目: | 93行目: | ||
}} |
}} |
||
| − | == |
+ | === マルチモニター === |
| + | 複数のモニターにバーを複製したい場合は、複数のバーを起動する必要があります。 |
||
| − | === 共有オブジェクトファイル libjsoncpp.so を開けません === |
||
| + | 起動スクリプトに次のような内容を追加します: |
||
| − | GitHubの [https://github.com/jaagr/polybar/issues/885 issue] の説明に従って再インストールを試みます。 |
||
| + | {{bc|1= |
||
| + | 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 を設定します: |
||
| − | 失敗した場合は、{{Pkg|jsoncpp}} パッケージを [[インストール]] してみてください。 |
||
| + | {{hc|config.ini|2= |
||
| + | [bar/example] |
||
| + | monitor = ${env:MONITOR:} |
||
| + | [..] |
||
| + | }} |
||
== 参照 == |
== 参照 == |
||
2023年12月4日 (月) 02:14時点における版
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 # Wait until the processes have been shut down while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done # Launch Polybar, using default config location ~/.config/polybar/config polybar & echo "Polybar launched..."
上記のスクリプトを使うとウィンドウマネージャを再起動したときにPolybarも再起動されます。以下のようにカスタマイズすることもできます:
MONITOR=HDMI-A-1 polybar &
上記のコマンドでは指定したモニターにPolybarが表示されます (モニターはxrandrコマンドで確認できます)。Polybarの位置を指定するには:
polybar top &
bspwm
bspwmを使用する場合、以下をbspwmrcに追加:
$HOME/.config/polybar/launch.sh
i3
i3を使用する場合、以下を設定に追加:
exec_always --no-startup-id $HOME/.config/polybar/launch.sh
マルチモニター
複数のモニターにバーを複製したい場合は、複数のバーを起動する必要があります。
起動スクリプトに次のような内容を追加します:
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:}
[..]