Ubuntu下使用 Compton 提升稳定性的实用方案
一 基础配置与驱动
sudo ubuntu-drivers autoinstall 更新驱动。二 稳定性专项设置
--benchmark 1000000 缓解录屏闪烁(注意会带来更高的 CPU 占用与温度,不建议长期开启)。cpulimit -l 50 -p $(pgrep compton)),减少高负载场景下的失稳风险。三 推荐的稳健配置示例
# ~/.config/compton.conf
backend = "glx"
vsync = "true" # 如仍有撕裂,可尝试 "false"
shadow = false
opacity-rule = [ "100:class_g = 'Firefox'", "100:class_g = 'Terminal'" ]
# 如需透明/模糊,请逐项开启并充分测试稳定性
# opacity = true
# blur-background = true
# blur-kern = "3x3box"
# 可选:降低重绘压力(按显示器实际刷新率设置)
# refresh-rate = 60
killall compton && compton --config ~/.config/compton.conf & 使配置生效。四 故障排查与兜底
ps -e | grep compton 检查进程;会话级管理可直接 killall compton && compton ... & 重启;若使用 systemd 管理,确保服务文件正确并 systemctl --user restart compton(或全局 sudo systemctl restart compton)。sudo ubuntu-drivers autoinstall 更新显卡驱动;确认 OpenGL 正常、libxss1/libxtst6 等依赖已安装;必要时回退/更换 backend 验证兼容性。