安装Compton
sudo apt update && sudo apt install compton
注:部分新系统可能默认使用picom(Compton分支),可尝试sudo apt install picom。
创建/编辑配置文件
mkdir -p ~/.config/compton
compton --example-config > ~/.config/compton/compton.conf
或直接编辑~/.config/compton.conf。
关键优化参数
backend = glx(需显卡支持OpenGL)。shadow = false、opacity = 1.0,减少渲染负载。vsync = true(减少画面撕裂),或设为false提升帧率。ignore_root = true,避免兼容性问题。重启Compton生效
killall compton
compton --config ~/.config/compton.conf -b &
或通过systemctl restart compton重启(若使用systemd管理)。
限制资源占用(可选)
若Compton占用CPU过高,可使用cpulimit限制其CPU使用率(例如限制为50%):
cpulimit -l 50 -p $(pgrep compton)
验证配置
检查Compton进程是否运行:ps aux | grep compton,并观察桌面性能是否改善。