一、安装Compton
首先需要通过包管理器安装Compton,不同发行版的命令如下:
sudo apt install comptonsudo dnf install comptonsudo pacman -S compton二、配置Compton的核心特效
Compton的配置文件通常位于~/.config/compton.conf(若不存在则手动创建),通过修改以下关键参数可实现炫酷视觉效果:
shadow = true开启窗口阴影,使窗口更具立体感;可通过shadow-exponent调整阴影模糊程度(值越大越柔和,如shadow-exponent = 3),shadow-color设置阴影颜色(如shadow-color = "#00000080"表示半透明黑色)。bg-blur = true开启背景模糊,突出窗口内容;可配合blur-strength调整模糊强度(如blur-strength = 5)。opacity设置全局透明度(如opacity = 0.9,值越低越透明);或使用opacity-rule针对特定应用设置透明度(如opacity-rule = ["CLASS='Firefox'", "opacity=0.8"],使Firefox窗口透明度为80%)。fade = true开启窗口淡入淡出效果,提升操作流畅感;fade-delta控制动画速度(如fade-delta = 0.05,值越小动画越慢)。screen-edge-blur = true,当窗口靠近屏幕边缘时自动模糊,营造沉浸式体验。backend参数决定渲染方式,推荐使用glx(GPU加速,性能更好)或x11(兼容性更强),如backend = "glx"。vsync = true开启垂直同步,避免画面撕裂;若出现卡顿,可设置为false。shadow-exclude排除不需要阴影的窗口(如shadow-exclude = ["class_g = 'Firefox'", "class_g = 'Compton'"],避免Firefox或Compton自身显示阴影)。三、启动与自动化
killall compton && compton -c ~/.config/compton.conf重启Compton应用更改。.xprofile或.xinitrc),添加compton -b -c ~/.config/compton.conf(-b表示后台运行),然后执行source ~/.xprofile使设置生效。四、注意事项
bg-blur或降低shadow-exponent值,避免卡顿。compton -c ~/.config/compton.conf -v查看详细日志,定位并解决问题。