以下是CentOS下Compton的配置要点:
安装Compton
sudo yum install compton # CentOS 7
sudo dnf install compton # CentOS 8+
配置文件路径
/etc/compton.conf
(系统级)或 ~/.config/compton.conf
(用户级)。sudo nano /etc/compton.conf # 系统级
nano ~/.config/compton.conf # 用户级
核心配置选项
glx
(推荐,支持GPU加速)或wayland
。backend = "glx";
shadow = false;
frame-rate-limit = 60;
vsync = true;
(根据需求调整)alpha-max = 0.8; alpha-min = 0.5;
disable-gradient = true;
启动与自启动
compton -c /etc/compton.conf
sudo nano /etc/systemd/system/compton.service
添加内容:[Unit]
Description=Compton Compositor
After=display-manager.service
[Service]
ExecStart=/usr/bin/compton -c /etc/compton.conf
Restart=always
[Install]
WantedBy=multi-user.target
启用服务:sudo systemctl enable compton
sudo systemctl start compton
调试与优化
compton -c /etc/compton.conf 2> /var/log/compton.log
。cpulimit
限制CPU占用,例如cpulimit -l 50 -p $(pgrep compton)
。注意:配置后需重启Compton生效,部分选项(如多显示器)需结合xrandr
调整显示器布局。若性能仍不理想,可尝试禁用更多特效或更换为轻量级合成器(如Xcompmgr)。