在 CentOS 上配置 compton(现在多称为 picom 的前身)一般用于给窗口管理器(如 i3、Openbox、awesome 等)提供透明、阴影、模糊等合成效果。下面按步骤说明。
sudo yum install -y epel-release
CentOS 7
sudo yum install -y compton
CentOS 8 / Stream
sudo dnf install -y compton
如果仓库没有,可使用
picom(compton 的活跃分支):
sudo dnf install -y picom
配置文件通常位于:
~/.config/compton.conf
示例配置(常用):
backend = "glx";
glx-no-stencil = true;
shadow = true;
shadow-radius = 8;
shadow-opacity = 0.4;
shadow-offset-x = -2;
shadow-offset-y = -2;
opacity-rule = [
"90:class_g = 'URxvt'",
"95:class_g = 'Firefox'"
];
fading = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
vsync = "opengl";
unredir-if-possible = true;
compton --config ~/.config/compton.conf &
在 ~/.config/i3/config 中加入:
exec --no-startup-id compton --config ~/.config/compton.conf
尝试切换 backend:
backend = "xrender";
建议使用:
backend = "glx";
glx-no-stencil = true;
vsync = "none";
可手动编译:
sudo yum install -y git meson ninja-build libconfig-devel dbus-devel xcb-devel
git clone https://github.com/yshui/picom.git
cd picom
meson setup build
ninja -C build
sudo ninja -C build install
ps aux | grep compton
如果你使用的是 具体窗口管理器(i3 / Openbox / awesome) 或 CentOS 版本,可以告诉我,我可以给你更精确的配置。