安装Compton
根据发行版选择命令:
sudo apt install compton
sudo pacman -S compton
sudo dnf install compton
基础配置
编辑配置文件 ~/.config/compton.conf
,关键参数:
shadow = true
(启用阴影)opacity = 0.9
(设置窗口透明度,0-1之间)blur = true
(启用背景模糊,需显卡支持)backend = "glx"
(使用GPU加速的后端)vsync = true
(开启垂直同步,减少画面撕裂)unredir-if-possible = true
(减少重绘,提升性能)高级优化
shadow-exclude = ["class_g = 'Firefox'"]
(为特定应用禁用阴影)opacity-exclude = ["window_type = 'dock'"]
(为Dock等区域禁用透明)corner-radius = 10
(设置窗口圆角半径)screen-edge-blur = true
(启用屏幕边缘模糊)启动与自启动
compton --config ~/.config/compton.conf -b
/etc/systemd/system/compton.service
,内容如下:[Unit]
Description=Compton Compositor
After=display-manager.service
[Service]
ExecStart=/usr/bin/compton --config /etc/compton.conf
Restart=on-failure
[Install]
WantedBy=multi-user.target
然后执行:sudo systemctl enable compton && sudo systemctl start compton
调试与调整
compton --config ~/.config/compton.conf --log-level INFO
killall compton
compton --config ~/.config/compton.conf --benchmark 100
根据硬件配置调整参数,例如低性能设备可关闭模糊和透明效果,优先保证流畅度。