CentOS 上优化 Compton 的实用步骤
一 基础准备与安装
sudo dnf install compton;在 CentOS 7 使用 YUM:sudo yum install compton。安装完成后建议先备份现有配置:cp ~/.config/compton.conf ~/.config/compton.conf.bak(若不存在可跳过)。配置文件常见路径为 ~/.config/compton.conf 或 /etc/xdg/compton.conf。二 关键配置优化
三 示例配置与生效方式
backend = glx
vsync = true
shadow = false
opacity = false
frame-rate = 60
backend = glx
vsync = true
shadow = true
opacity = 0.9
ignore_root = true
[blur]
method = gaussian
size = 6
deviation = 2.5
[opacity-rule]
"90:class_g 'Firefox'"
"92:class_g 'Terminal'"
killall compton && compton --config ~/.config/compton.conf &[Unit]
Description=Compton Window Composer
After=graphical-session.target
[Service]
ExecStart=/usr/bin/compton --config %h/.config/compton.conf
Restart=always
[Install]
WantedBy=graphical-session.target
启用:systemctl --user daemon-reload && systemctl --user enable --now compton。如需系统级服务,可将相同内容放到 /etc/systemd/system/compton.service 并以 root 启用。四 进阶优化与排错
cpulimit -l 50 -p $(pgrep compton)),缓解短时高占用对系统的影响。xrandr --query 查看,按实际拓扑设置扩展/主显示器),避免合成器对未正确识别的显示器做无效合成。