项目简介
Polybar 是一个用 C++ 编写的轻量级、快速的状态栏应用项目,专为 Linux 系统打造。它不仅能够显示系统信息,还能集成各种功能,比如媒体控制、窗口管理等,让你的桌面状态栏既美观又实用。
目前,Polybar 在 GitHub 上已经获得了 14K 的 star。
性能特色
- 高度可定制:支持自定义显示内容、颜色、字体、图标等,几乎所有外观和行为都可以通过配置文件调整。
- 丰富的模块:内置多种模块,如系统托盘图标、窗口标题、媒体播放控制、音量控制、CPU 和内存使用率、网络连接详情等。
- 支持多种窗口管理器:无论你使用的是 bspwm、i3 还是其他 EWMH 兼容的窗口管理器,Polybar 都能完美集成。
- 高效稳定:作为 C++ 编写的工具,Polybar 表现出色,能够确保桌面状态栏的流畅运行。
- 轻量级高效:占用系统资源少,适合对性能要求高的用户。
- 支持脚本扩展:可以通过 Shell 脚本为 Polybar 增加自定义功能,满足进阶用户需求。
快速安装与使用
安装 Polybar 很简单,不同的 Linux 发行版安装方式稍有不同。以 Ubuntu 为例,在终端中输入:
sudo apt install polybar
安装完成后,Polybar 会自动将默认配置文件放到 /etc/polybar/config.ini
。当然,我们也可以通过创建 ~/.config/polybar/config.ini
文件来进行个性化配置。
配置文件使用的是 INI 格式,非常直观易懂。可以通过修改配置文件中的各个参数来调整状态栏的样式和功能,比如修改颜色设置、添加或删除模块等。
在终端中输入 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: notice)
LEVEL is one of: error, warning, notice, 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 (Removes cloned monitors)
-M, --list-all-monitors Print list of all available monitors (Including cloned 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 的体验非常棒。我们可以根据自己的需求,调整状态栏的样式和功能。例如,可以设置状态栏显示时间、日期、CPU 和内存使用率、电池状态等。
项目地址
感兴趣的可以访问 Polybar 的 GitHub 项目地址,获取更多细节和功能: