你提到的 “Compton” 通常是指 Linux 下的窗口合成器(compositor),用于实现透明、阴影、动画等桌面特效。在 CentOS 上配置 Compton,一般步骤如下(以 CentOS 7 / 8 为例,使用 X11 桌面环境如 GNOME、MATE、XFCE 等):
sudo yum install epel-release
sudo yum install compton
sudo dnf install epel-release
sudo dnf install compton
如果仓库中没有
compton,可以改用picom(Compton 的活跃分支):
sudo dnf install picom
用户级配置文件一般放在:
~/.config/compton.conf
示例配置(常用):
# 阴影
shadow = true;
shadow-radius = 12;
shadow-opacity = 0.5;
shadow-offset-x = -5;
shadow-offset-y = -5;
# 透明
opacity-rule = [
"90:class_g = 'URxvt'",
"95:class_g = 'Firefox'"
];
# 动画(部分版本支持)
fading = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
# 后端
backend = "glx";
vsync = true;
# 忽略全屏
unredir-if-possible = true;
compton --config ~/.config/compton.conf &
或(picom):
picom --config ~/.config/compton.conf &
Comptoncompton --config ~/.config/compton.conf在 ~/.xprofile 或 ~/.xinitrc 中加入:
compton --config ~/.config/compton.conf &
backend = "xrender";
vsync = false;
Compton / picom 只支持 X11
如果是 CentOS 使用 Wayland(GNOME 默认),需要:
echo $XDG_SESSION_TYPE
若为 wayland,登录时选择 GNOME on Xorg
官方源可能已无 compton,建议:
picomps aux | grep compton
能看到进程即成功。
如果你说的是 “Compton 在 CentOS 服务器 / 特定桌面 / 云桌面” 的场景,可以告诉我:
我可以提供更精准的配置。