安装Compton
sudo yum update -y
sudo yum install -y epel-release cmake libX11-devel mesa-libGL
git clone https://github.com/compton/compton.git
cd compton && mkdir build && cmake .. && make && sudo make install
配置Compton
~/.config/compton.conf
,常用优化参数:backend = "glx" # 选择GLX后端提升性能
shadow = true # 启用阴影(可自定义排除区域)
opacity = 0.9 # 窗口透明度(0-1)
vsync = true # 启用垂直同步减少撕裂
cache-size = 1024 # 缓存大小(MB),降低延迟
blur = true # 启用背景模糊
shadow-exclude = ["class_g 'Xfce4-Panel'", "name 'Notification'"]
启动与自动运行
compton --config ~/.config/compton.conf
/etc/systemd/system/compton.service
:[Unit]
Description=Compton Compositor
After=display-manager.service
[Service]
ExecStart=/usr/local/bin/compton --config ~/.config/compton.conf
Restart=always
[Install]
WantedBy=multi-user.target
启用并启动服务:sudo systemctl enable compton && sudo systemctl start compton
优化与调试
glxgears
测试帧率,调整 vsync
或 cache-size
。fade
或 shadow
。-o /tmp/compton.log
参数查看运行状态。注意:CentOS默认使用X11,若使用Wayland需确认Compton兼容性,部分参数需调整。建议根据硬件配置(如集成显卡/独显)选择后端(glx
/xrender
)。