Compton在CentOS上的调试与配置指南
sudo yum update -y # CentOS 7
sudo dnf update -y # CentOS 8及以上
sudo yum install epel-release添加)。sudo yum install compton -y # CentOS 7
sudo dnf install compton -y # CentOS 8及以上
若包管理器中无Compton,可从源码编译安装(参考Compton GitHub文档)。~/.config/compton.conf(用户级)或/etc/compton.conf(系统级)。若文件不存在,手动创建即可。backend = "glx";(推荐,硬件加速,适用于大多数桌面环境);若遇兼容性问题,可改用xrender。shadow = true;(启用阴影);shadow-exclude = ["name = 'Notification'", "class_g = 'Conky'"];(排除通知栏、Conky等窗口的阴影)。inactive-opacity = 0.8;(非活动窗口透明度0.8);active-opacity = 1.0;(活动窗口完全不透明);opacity-rule = ["90:class_g = 'Alacritty'", "80:class_g = 'Thunar'"];(为特定应用设置透明度)。vsync = true;(开启垂直同步,避免画面撕裂)。blur-background = true;(启用背景模糊);blur-method = "kawase";(模糊算法,可选kawase/gaussian);blur-strength = 5;(模糊强度,数值越大越模糊)。compton(终端中执行,显示实时日志)。compton -b(-b表示后台模式)。/etc/systemd/system/compton.service,内容如下:[Unit]
Description=Compton Window Composer
After=display-manager.service # 确保在显示管理器启动后运行
[Service]
ExecStart=/usr/bin/compton -c /etc/compton.conf # 指定配置文件路径
Restart=always # 崩溃后自动重启
[Install]
WantedBy=multi-user.target # 多用户模式下启动
sudo systemctl daemon-reload # 重新加载Systemd配置
sudo systemctl enable compton # 设置开机自启动
sudo systemctl start compton # 立即启动服务
```。
--verbose参数输出详细日志,帮助定位问题。compton --verbose 2> /var/log/compton.log # 将日志重定向到文件
cat /var/log/compton.log # 查看日志内容
ps -e | grep compton # 若无输出,说明未运行
sudo systemctl restart compton # 重启服务
vsync = true;已开启,或尝试更换后端(如backend = "glx";)。shadow-exclude规则是否覆盖了目标窗口(如通知栏、桌面图标)。blur-background = false;)或降低模糊强度(blur-strength = 3;)。blur-strength、减少透明度规则数量)。cp ~/.config/compton.conf ~/.config/compton.conf.bak),避免配置错误导致无法启动。