在 CentOS 上配置 Compton(窗口合成器,常用于 i3 / 无桌面环境时做透明、阴影、动画等),一般步骤如下:
sudo yum install -y epel-release
sudo yum install -y compton
sudo dnf install -y epel-release
sudo dnf install -y compton
如果仓库没有 compton,可用
picom(compton 的 fork):
sudo dnf install -y picom
mkdir -p ~/.config/compton
vim ~/.config/compton/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-swc";
compton --config ~/.config/compton/compton.conf -b
-b 表示后台运行
picom --config ~/.config/compton/compton.conf -b
在 ~/.config/i3/config 添加:
exec --no-startup-id compton --config ~/.config/compton/compton.conf -b
mkdir -p ~/.config/autostart
vim ~/.config/autostart/compton.desktop
内容:
[Desktop Entry]
Type=Application
Exec=compton --config ~/.config/compton/compton.conf -b
Hidden=false
X-GNOME-Autostart-enabled=true
Name=Compton
backend = "xrender"vsyncxrender 更稳定glx + 闭源驱动组合问题picom如果你用的是 CentOS 几 + 桌面环境(GNOME/i3/无桌面),我可以给你更精确的配置。