在 CentOS 上,Compton 的节能思路是通过降低合成器负载与 GPU/CPU 频率波动,减少不必要的图形特效,从而降低功耗与发热。
# 渲染与同步
backend = "xrender" # 老旧/低功耗设备可优先;若 glx 驱动良好也可尝试 "glx"
vsync = "true" # 减少撕裂与不必要重绘,按设备实测微调
# 特效开关(节能优先:能关则关)
shadow = false # 关闭阴影
opacity = 1.0 # 避免半透明合成
blur-background = false # 关闭背景模糊
fading = false # 关闭淡入淡出动画
focus-exclude = [ "class_g='Conky'" ] # 对常驻叠加层排除合成(可选)
# 其他稳定性与性能项
mark-wmwin-focused = true
mark-ovredir-focused = true
detect-rounded-corners = true
detect-client-leader = true
unredir-if-possible = true
killall comptoncompton --config ~/.config/compton.conf -fcompton --config ~/.config/compton.conf &~/.config/systemd/user/compton.service[Unit]
Description=Compton Window Composer
After=graphical-session.target
[Service]
ExecStart=/usr/bin/compton --config %h/.config/compton.conf
Restart=on-failure
[Install]
WantedBy=default.target
systemctl --user daemon-reload
systemctl --user enable --now compton.service
htop/top 查看 compton 的 %CPU 与 %MEM;必要时用 cpulimit -l 50 -p $(pgrep compton) 临时限流验证稳定性。vsync 取值或改用 backend = "glx" 再测;若仍不理想,可逐步恢复少量必要特效。xrandr --query 检查输出,必要时在配置中通过 shadow-exclude、focus-exclude 等对特定窗口/显示器排除合成,减少无效工作。