在 CentOS 上配置 compton(一个轻量级 X11 合成管理器,常用于 i3 / openbox 等窗口管理器实现透明和阴影)大致步骤如下。下面以 CentOS 7/8 为例,CentOS 9 也基本类似(但仓库可能更偏 EPEL)。
sudo yum install -y epel-release
# CentOS 8 用 dnf
sudo dnf install -y epel-release
sudo yum install -y compton
# 或
sudo dnf install -y compton
如果仓库里没有
compton,可以考虑用picom(compton 的 fork):
sudo dnf install -y picom
mkdir -p ~/.config/compton
vi ~/.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;
fade = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
opacity-rule = [
"90:class_g = 'URxvt'",
"95:class_g = 'Firefox'"
];
vsync = "opengl-swc";
compton --config ~/.config/compton/compton.conf &
在 ~/.config/i3/config 中加入:
exec --no-startup-id compton --config ~/.config/compton/compton.conf
如果是 Openbox:
echo "compton --config ~/.config/compton/compton.conf &" >> ~/.config/openbox/autostart
尝试改为:
backend = "xrender";
直接用 picom:
picom --config ~/.config/compton/compton.conf
ps aux | grep compton
如果你能告诉我:
我可以给你更精确的配置。