你提到的 Compton 一般是指 Linux 下的轻量级 X11 合成器(现在社区里更多是它的继任者 picom)。下面分别说明在 CentOS 上如何安装和配置。
CentOS 7 官方源里没有 compton,需要 EPEL 或手动编译:
sudo yum install epel-release
sudo yum install compton
如果没有包:
# 手动编译(示例)
sudo yum install git gcc make libconfig-devel dbus-devel xcb-devel
git clone https://github.com/chjj/compton.git
cd compton
make
sudo make install
推荐直接用 picom(compton 的维护分支):
sudo dnf install picom
或:
sudo dnf install epel-release
sudo dnf install picom
示例配置(透明 + 阴影 + 淡入淡出):
backend = "glx";
opacity-rule = [
"90:class_g = 'URxvt'",
"95:class_g = 'Firefox'"
];
shadow = true;
shadow-radius = 8;
shadow-offset-x = -2;
shadow-offset-y = -2;
shadow-opacity = 0.4;
fading = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
vsync = true;
compton --config ~/.config/compton.conf -b
或 picom:
picom --config ~/.config/picom.conf -b
在 ~/.xinitrc 或桌面环境自启里加:
compton -b &
黑屏 / 无透明
CentOS 默认是 GNOME + Wayland
性能差
backend = "xrender"如果你能说明:
我可以给你更精确的配置。