温馨提示×

如何在Ubuntu上配置Compton优化图形性能

小樊
40
2025-09-02 14:12:03
栏目: 智能运维

  1. 安装Compton

    sudo apt update && sudo apt install compton  
    

    注:部分新系统可能默认使用picom(Compton分支),可尝试sudo apt install picom

  2. 创建/编辑配置文件

    mkdir -p ~/.config/compton  
    compton --example-config > ~/.config/compton/compton.conf  
    

    或直接编辑~/.config/compton.conf

  3. 关键优化参数

    • 启用GPU加速:设置backend = glx(需显卡支持OpenGL)。
    • 关闭阴影/透明shadow = falseopacity = 1.0,减少渲染负载。
    • 调整垂直同步vsync = true(减少画面撕裂),或设为false提升帧率。
    • 忽略根窗口透明ignore_root = true,避免兼容性问题。
  4. 重启Compton生效

    killall compton  
    compton --config ~/.config/compton.conf -b &  
    

    或通过systemctl restart compton重启(若使用systemd管理)。

  5. 限制资源占用(可选)
    若Compton占用CPU过高,可使用cpulimit限制其CPU使用率(例如限制为50%):

    cpulimit -l 50 -p $(pgrep compton)  
    
  6. 验证配置
    检查Compton进程是否运行:ps aux | grep compton,并观察桌面性能是否改善。

0