根据需求定制CentOS Compton配置步骤如下:
安装Compton
sudo yum install compton
创建/编辑配置文件
~/.config/compton.conf(用户级)或/etc/compton.conf(系统级)。mkdir -p ~/.config
nano ~/.config/compton.conf
常用配置选项
| 需求场景 | 配置参数 | 示例 |
|---|---|---|
| 选择后端 | backend |
backend = "glx";(推荐) |
| 启用/禁用阴影 | shadow |
shadow = true; 或 shadow = false; |
| 设置透明度 | opacity/alpha |
opacity = 0.8; |
| 排除特定窗口阴影 | shadow-exclude |
shadow-exclude = [ "class_g = 'gnome-terminal'" ]; |
| 背景模糊 | blur-background/blur-kern |
blur-background = true; blur-kern = "3x3box"; |
| 垂直同步 | vsync |
vsync = true; |
保存并重启Compton
# 命令行直接重启(临时生效)
killall compton
compton -c ~/.config/compton.conf &
# 或通过systemd服务永久生效(需提前创建服务文件)
sudo systemctl restart compton
高级定制
wm参数匹配当前桌面环境(如i3、gnome)。log-level = "debug"查看详细日志。注意:修改后需重启Compton生效,部分参数(如backend)需根据显卡驱动选择,建议参考Compton官方文档确认兼容性。