以下是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)。