你提到的 Compton 通常是指 Linux 下的 Compton 合成器(compositor),用于实现窗口透明、阴影、模糊等特效。在 CentOS 上启用 Compton,一般步骤如下(以 CentOS 7 / 8 为例,CentOS Stream 类似):
Compton 需要:
查看当前会话:
echo $XDG_SESSION_TYPE
如果是 wayland,建议切换到 X11(注销后在登录界面选择 “GNOME on Xorg”)。
sudo yum install epel-release
sudo yum install compton
sudo dnf install epel-release
sudo dnf install compton
如果仓库没有:
sudo dnf install compton --enablerepo=epel
mkdir -p ~/.config/compton
nano ~/.config/compton/compton.conf
示例配置:
backend = "glx";
glx-no-stencil = true;
shadow = true;
shadow-radius = 10;
shadow-opacity = 0.4;
fade = true;
opacity-rule = [
"90:class_g = 'URxvt'",
"95:class_g = 'Firefox'"
];
compton --config ~/.config/compton/compton.conf -b
-b 表示后台运行。
GNOME / MATE:
compton --config ~/.config/compton/compton.conf -b
i3 / 其他 WM:
在 ~/.xinitrc 或 WM 配置中加入:
compton -b &
尝试:
backend = "xrender";
或关闭 shadow:
shadow = false;
建议加:
vsync = true;
unredir-if-possible = true;
CentOS 默认用 mutter(GNOME 自带合成器),不需要 Compton。
只有在 i3 / Openbox / 轻量桌面 才需要。
Compton 已停止维护,新项目是 picom:
sudo dnf install picom
picom --config ~/.config/picom/picom.conf -b
如果你能告诉我:
我可以给你更精确的配置。