一、安裝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查看詳細日志,定位并解決問題。