Compton配置文件编写及生效步骤如下:
定位/创建配置文件
.config/compton.conf(如~/.config/compton.conf)。mkdir -p ~/.config
touch ~/.config/compton.conf
编辑配置文件
nano、vim)修改,注意YAML格式缩进。backend: "glx" # 合成后端,可选x11/wayland/glx
shadow: true # 启用阴影
shadow-exclude: # 排除特定窗口阴影(支持类名、正则)
- "class_g = 'Firefox'"
- "class_g = 'Thunderbird'"
opacity: 0.9 # 全局透明度(0-1)
blur-radius: 5 # 模糊半径
glx-no-stencil: true # 禁用模板缓冲区(提升性能)
保存并重启生效
# 手动重启(非系统服务)
pkill compton
compton --config ~/.config/compton.conf &
# 若为系统服务(需提前配置)
sudo systemctl restart compton
注意事项:
compton --config /path/to/config.conf --debug调试。backend)需根据系统环境选择(如Wayland环境需设为wayland)。man compton。