Compton與Ubuntu結合需注意兼容性并優化配置,以下是關鍵步驟:
安裝Compton
使用APT包管理器安裝:
sudo apt update && sudo apt install compton
注意:Compton已停止維護,Ubuntu官方推薦使用picom替代。
配置優化
~/.config/compton.conf
,常用參數:backend = glx # 啟用GPU加速(需安裝NVIDIA/AMD驅動)
vsync = true # 開啟垂直同步,減少畫面撕裂
shadow = true # 啟用窗口陰影(可設為false提升性能)
opacity = 0.9 # 設置窗口透明度(0.0-1.0)
ignore_root = true # 解決桌面環境兼容性問題
啟動與自動運行
compton --config ~/.config/compton.conf
。/etc/systemd/system/compton.service
,內容如下:[Unit]
Description=Compton Window Composer
After=graphical.target
[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
兼容性處理
性能監控
使用 htop
或 top
監控資源占用,若CPU負載過高,可通過 cpulimit
限制Compton進程:
cpulimit -l 50 -p $(pgrep compton)
提示:Compton開發已終止,建議優先選擇picom,其兼容性和性能更優,配置方式類似。